From Jason Turner

[pointer.traits]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpsitxyf54/{from.md → to.md} +24 -20
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
- typedef Ptr pointer;
10
- typedef see below element_type;
11
- typedef see below difference_type;
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
- typedef T* pointer;
20
- typedef T element_type;
21
- typedef ptrdiff_t difference_type;
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
- typedef see below element_type;
34
  ```
35
 
36
- *Type:* `Ptr::element_type` if such a type exists; otherwise, `T` if
37
- `Ptr` is a class template instantiation of the form
38
- `SomePointer<T, Args>`, where `Args` is zero or more type arguments;
39
- otherwise, the specialization is ill-formed.
 
40
 
41
  ``` cpp
42
- typedef see below difference_type;
43
  ```
44
 
45
- *Type:* `Ptr::difference_type` if such a type exists; otherwise,
46
- `std::ptrdiff_t`.
 
47
 
48
  ``` cpp
49
  template <class U> using rebind = see below;
50
  ```
51
 
52
- *Alias template:* `Ptr::rebind<U>` if such a type exists; otherwise,
53
- `SomePointer<U, Args>` if `Ptr` is a class template instantiation of the
54
- form `SomePointer<T, Args>`, where `Args` is zero or more type
55
- arguments; otherwise, the instantiation of `rebind` is ill-formed.
 
 
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 (possibly cv-qualified) `void`, the type of `r` 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 `std::addressof(r)`.
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