tmp/tmpsitxyf54/{from.md → to.md}
RENAMED
|
@@ -4,23 +4,23 @@ The class template `pointer_traits` supplies a uniform interface to
|
|
| 4 |
certain attributes of pointer-like types.
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
namespace std {
|
| 8 |
template <class Ptr> struct pointer_traits {
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
template <class U> using rebind = see below;
|
| 14 |
|
| 15 |
static pointer pointer_to(see below r);
|
| 16 |
};
|
| 17 |
|
| 18 |
template <class T> struct pointer_traits<T*> {
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
template <class U> using rebind = U*;
|
| 24 |
|
| 25 |
static pointer pointer_to(see below r) noexcept;
|
| 26 |
};
|
|
@@ -28,45 +28,49 @@ namespace std {
|
|
| 28 |
```
|
| 29 |
|
| 30 |
#### Pointer traits member types <a id="pointer.traits.types">[[pointer.traits.types]]</a>
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
-
|
| 34 |
```
|
| 35 |
|
| 36 |
-
*Type:* `Ptr::element_type` if
|
| 37 |
-
|
| 38 |
-
`SomePointer<T, Args>`, where
|
| 39 |
-
otherwise, the specialization is
|
|
|
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
-
|
| 43 |
```
|
| 44 |
|
| 45 |
-
*Type:* `Ptr::difference_type` if
|
| 46 |
-
`
|
|
|
|
| 47 |
|
| 48 |
``` cpp
|
| 49 |
template <class U> using rebind = see below;
|
| 50 |
```
|
| 51 |
|
| 52 |
-
*Alias template:* `Ptr::rebind<U>` if
|
| 53 |
-
`
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
#### Pointer traits member functions <a id="pointer.traits.functions">[[pointer.traits.functions]]</a>
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
static pointer pointer_traits::pointer_to(see below r);
|
| 61 |
static pointer pointer_traits<T*>::pointer_to(see below r) noexcept;
|
| 62 |
```
|
| 63 |
|
| 64 |
-
If `element_type` is
|
| 65 |
unspecified; otherwise, it is `element_type&`.
|
| 66 |
|
| 67 |
*Returns:* The first member function returns a pointer to `r` obtained
|
| 68 |
by calling `Ptr::pointer_to(r)` through which indirection is valid; an
|
| 69 |
instantiation of this function is ill-formed if `Ptr` does not have a
|
| 70 |
matching `pointer_to` static member function. The second member function
|
| 71 |
-
returns `
|
| 72 |
|
|
|
|
| 4 |
certain attributes of pointer-like types.
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
namespace std {
|
| 8 |
template <class Ptr> struct pointer_traits {
|
| 9 |
+
using pointer = Ptr;
|
| 10 |
+
using element_type = see below;
|
| 11 |
+
using difference_type = see below;
|
| 12 |
|
| 13 |
template <class U> using rebind = see below;
|
| 14 |
|
| 15 |
static pointer pointer_to(see below r);
|
| 16 |
};
|
| 17 |
|
| 18 |
template <class T> struct pointer_traits<T*> {
|
| 19 |
+
using pointer = T*;
|
| 20 |
+
using element_type = T;
|
| 21 |
+
using difference_type = ptrdiff_t;
|
| 22 |
|
| 23 |
template <class U> using rebind = U*;
|
| 24 |
|
| 25 |
static pointer pointer_to(see below r) noexcept;
|
| 26 |
};
|
|
|
|
| 28 |
```
|
| 29 |
|
| 30 |
#### Pointer traits member types <a id="pointer.traits.types">[[pointer.traits.types]]</a>
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
+
using element_type = see below;
|
| 34 |
```
|
| 35 |
|
| 36 |
+
*Type:* `Ptr::element_type` if the *qualified-id* `Ptr::element_type` is
|
| 37 |
+
valid and denotes a type ([[temp.deduct]]); otherwise, `T` if `Ptr` is
|
| 38 |
+
a class template instantiation of the form `SomePointer<T, Args>`, where
|
| 39 |
+
`Args` is zero or more type arguments; otherwise, the specialization is
|
| 40 |
+
ill-formed.
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
+
using difference_type = see below;
|
| 44 |
```
|
| 45 |
|
| 46 |
+
*Type:* `Ptr::difference_type` if the *qualified-id*
|
| 47 |
+
`Ptr::difference_type` is valid and denotes a type ([[temp.deduct]]);
|
| 48 |
+
otherwise, `ptrdiff_t`.
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
template <class U> using rebind = see below;
|
| 52 |
```
|
| 53 |
|
| 54 |
+
*Alias template:* `Ptr::rebind<U>` if the *qualified-id*
|
| 55 |
+
`Ptr::rebind<U>` is valid and denotes a type ([[temp.deduct]]);
|
| 56 |
+
otherwise, `SomePointer<U, Args>` if `Ptr` is a class template
|
| 57 |
+
instantiation of the form `SomePointer<T, Args>`, where `Args` is zero
|
| 58 |
+
or more type arguments; otherwise, the instantiation of `rebind` is
|
| 59 |
+
ill-formed.
|
| 60 |
|
| 61 |
#### Pointer traits member functions <a id="pointer.traits.functions">[[pointer.traits.functions]]</a>
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
static pointer pointer_traits::pointer_to(see below r);
|
| 65 |
static pointer pointer_traits<T*>::pointer_to(see below r) noexcept;
|
| 66 |
```
|
| 67 |
|
| 68 |
+
*Remarks:* If `element_type` is cv `void`, the type of `r` is
|
| 69 |
unspecified; otherwise, it is `element_type&`.
|
| 70 |
|
| 71 |
*Returns:* The first member function returns a pointer to `r` obtained
|
| 72 |
by calling `Ptr::pointer_to(r)` through which indirection is valid; an
|
| 73 |
instantiation of this function is ill-formed if `Ptr` does not have a
|
| 74 |
matching `pointer_to` static member function. The second member function
|
| 75 |
+
returns `addressof(r)`.
|
| 76 |
|