From Jason Turner

[pointer.traits]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdsahzaqm/{from.md → to.md} +35 -17
tmp/tmpdsahzaqm/{from.md → to.md} RENAMED
@@ -20,57 +20,75 @@ namespace std {
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
  };
27
  }
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
 
 
20
  using element_type = T;
21
  using difference_type = ptrdiff_t;
22
 
23
  template<class U> using rebind = U*;
24
 
25
+ static constexpr pointer pointer_to(see below r) noexcept;
26
  };
27
  }
28
  ```
29
 
30
+ #### 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 a
38
+ 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]]; otherwise,
56
+ `SomePointer<U, Args>` if `Ptr` is a class template instantiation of the
57
+ form `SomePointer<T, Args>`, where `Args` is zero or more type
58
+ arguments; otherwise, the instantiation of `rebind` is ill-formed.
 
59
 
60
+ #### Member functions <a id="pointer.traits.functions">[[pointer.traits.functions]]</a>
61
 
62
  ``` cpp
63
  static pointer pointer_traits::pointer_to(see below r);
64
+ static constexpr pointer pointer_traits<T*>::pointer_to(see below r) noexcept;
65
  ```
66
 
67
+ *Mandates:* For the first member function, `Ptr::pointer_to(r)` is
68
+ well-formed.
69
+
70
+ *Preconditions:* For the first member function, `Ptr::pointer_to(r)`
71
+ returns a pointer to `r` through which indirection is valid.
72
+
73
+ *Returns:* The first member function returns `Ptr::pointer_to(r)`. The
74
+ second member function returns `addressof(r)`.
75
+
76
  *Remarks:* If `element_type` is cv `void`, the type of `r` is
77
  unspecified; otherwise, it is `element_type&`.
78
 
79
+ #### Optional members <a id="pointer.traits.optmem">[[pointer.traits.optmem]]</a>
80
+
81
+ Specializations of `pointer_traits` may define the member declared in
82
+ this subclause to customize the behavior of the standard library.
83
+
84
+ ``` cpp
85
+ static element_type* to_address(pointer p) noexcept;
86
+ ```
87
+
88
+ *Returns:* A pointer of type `element_type*` that references the same
89
+ location as the argument `p`.
90
+
91
+ [*Note 1*: This function should be the inverse of `pointer_to`. If
92
+ defined, it customizes the behavior of the non-member function
93
+ `to_address` [[pointer.conversion]]. — *end note*]
94