Corrections to pointer_traits documentation

This commit is contained in:
Glen Fernandes
2017-05-28 20:29:56 -04:00
parent 87dd2883b8
commit 89b1792724

View File

@@ -27,9 +27,9 @@ for obtaining raw pointers from pointers.
[section Examples] [section Examples]
The following function template can obtaining a raw pointer from a pointer, The following function template obtains a raw pointer from a pointer and is
which works with null pointers and also is well defined when the pointer well defined when the pointer aliases storage that has no object constructed
aliases storage that has no object constructed in it. in it.
``` ```
template<class T> template<class T>
@@ -72,7 +72,9 @@ namespace boost {
} }
``` ```
[heading Member types] [section Member types]
[heading `pointer_traits`]
[ordered_list [ordered_list
[`typedef` ['see below] `element_type;` [`typedef` ['see below] `element_type;`
@@ -96,33 +98,45 @@ namespace boost {
arguments; otherwise, the instantiation of `rebind_to` is arguments; otherwise, the instantiation of `rebind_to` is
ill-formed.]]]]] ill-formed.]]]]]
[heading Member functions] [endsect]
[section Member functions]
[heading `pointer_traits`]
[ordered_list [ordered_list
[`static pointer pointer_traits::pointer_to(`['see below] `v);` [`static pointer pointer_to(`['see below] `v);`
[variablelist [variablelist
[[Remark] [[Remark]
[If `element_type` is a void type, the type of `v` is unspecified; [If `element_type` is a void type, the type of `v` is unspecified;
otherwise, it is `element_type&`.]] otherwise, it is `element_type&`.]]
[[Returns] [[Returns]
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]] [A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]
[`static pointer pointer_traits<T*>::pointer_to(`['see below] `v) noexcept;` [`static element_type* to_address(pointer v) noexcept;`
[variablelist
[[Requires]
[`v` is not a null pointer.]]
[[Returns]
[A pointer of type `element_type*` that references the same location
as the argument.]]]]]
[heading `pointer_traits<T*>`]
[ordered_list
[`static pointer pointer_to(`['see below] `v) noexcept;`
[variablelist [variablelist
[[Remark] [[Remark]
[If `element_type` is a void type, the type of `v` is unspecified; [If `element_type` is a void type, the type of `v` is unspecified;
otherwise, it is `element_type&`.]] otherwise, it is `element_type&`.]]
[[Returns] [[Returns]
[The result of `std::addressof(v)`.]]]] [The result of `std::addressof(v)`.]]]]
[`static element_type* pointer_traits::to_address(pointer v) noexcept;` [`static element_type* to_address(pointer v) noexcept;`
[variablelist
[[Returns]
[A plain pointer of type `element_type*` obtained by calling
`pointer_traits::to_address` on the value of `v.operator->()`.]]]]
[`static element_type* pointer_traits<T*>::to_address(pointer v) noexcept;`
[variablelist [[Returns] [The value of `v`.]]]]] [variablelist [[Returns] [The value of `v`.]]]]]
[endsect] [endsect]
[endsect]
[section Acknowledgments] [section Acknowledgments]
Glen Fernandes implemented `pointer_traits` with reviews and guidance from Glen Fernandes implemented `pointer_traits` with reviews and guidance from