Commit 40f3e913 by Ville Voutilainen Committed by Ville Voutilainen

Clean up optional's comments.

From-SVN: r238436
parent 94e136b9
2016-07-18 Ville Voutilainen <ville.voutilainen@gmail.com>
Clean up optional's comments.
* include/std/optional: Remove incorrect section headers
from comments when redundant, replace bare section
headers with more descriptive comments.
2016-07-15 Jonathan Wakely <jwakely@redhat.com> 2016-07-15 Jonathan Wakely <jwakely@redhat.com>
* include/bits/algorithmfwd.h: Change C++0x to C++11 in comments. * include/bits/algorithmfwd.h: Change C++0x to C++11 in comments.
......
...@@ -51,13 +51,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -51,13 +51,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{ * @{
*/ */
// All subsequent [X.Y.n] references are against n3793.
// [X.Y.4]
template<typename _Tp> template<typename _Tp>
class optional; class optional;
// [X.Y.6]
/// Tag type to disengage optional objects. /// Tag type to disengage optional objects.
struct nullopt_t struct nullopt_t
{ {
...@@ -72,11 +68,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -72,11 +68,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit constexpr nullopt_t(_Construct) { } explicit constexpr nullopt_t(_Construct) { }
}; };
// [X.Y.6]
/// Tag to disengage optional objects. /// Tag to disengage optional objects.
constexpr nullopt_t nullopt { nullopt_t::_Construct::_Token }; constexpr nullopt_t nullopt { nullopt_t::_Construct::_Token };
// [X.Y.7]
/** /**
* @brief Exception class thrown when a disengaged optional object is * @brief Exception class thrown when a disengaged optional object is
* dereferenced. * dereferenced.
...@@ -172,7 +166,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -172,7 +166,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using _Stored_type = remove_const_t<_Tp>; using _Stored_type = remove_const_t<_Tp>;
public: public:
// [X.Y.4.1] Constructors.
// Constructors for disengaged optionals. // Constructors for disengaged optionals.
constexpr _Optional_base() noexcept constexpr _Optional_base() noexcept
...@@ -217,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -217,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
this->_M_construct(std::move(__other._M_get())); this->_M_construct(std::move(__other._M_get()));
} }
// [X.Y.4.3] (partly) Assignment. // Assignment operators.
_Optional_base& _Optional_base&
operator=(const _Optional_base& __other) operator=(const _Optional_base& __other)
{ {
...@@ -251,7 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -251,7 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this; return *this;
} }
// [X.Y.4.2] Destructor. // Destructor.
~_Optional_base() ~_Optional_base()
{ {
if (this->_M_engaged) if (this->_M_engaged)
...@@ -560,7 +553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -560,7 +553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit constexpr optional(optional<_Up>&& __t) explicit constexpr optional(optional<_Up>&& __t)
: _Base(__t ? optional<_Tp>(std::move(*__t)) : optional<_Tp>()) { } : _Base(__t ? optional<_Tp>(std::move(*__t)) : optional<_Tp>()) { }
// [X.Y.4.3] (partly) Assignment. // Assignment operators.
optional& optional&
operator=(nullopt_t) noexcept operator=(nullopt_t) noexcept
{ {
...@@ -650,9 +643,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -650,9 +643,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
this->_M_construct(__il, std::forward<_Args>(__args)...); this->_M_construct(__il, std::forward<_Args>(__args)...);
} }
// [X.Y.4.2] Destructor is implicit, implemented in _Optional_base. // Destructor is implicit, implemented in _Optional_base.
// [X.Y.4.4] Swap. // Swap.
void void
swap(optional& __other) swap(optional& __other)
noexcept(is_nothrow_move_constructible<_Tp>() noexcept(is_nothrow_move_constructible<_Tp>()
...@@ -674,7 +667,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -674,7 +667,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
} }
// [X.Y.4.5] Observers. // Observers.
constexpr const _Tp* constexpr const _Tp*
operator->() const operator->() const
{ return __constexpr_addressof(this->_M_get()); } { return __constexpr_addressof(this->_M_get()); }
...@@ -777,7 +770,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -777,7 +770,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __optional_relop_t = using __optional_relop_t =
enable_if_t<is_convertible<_Tp, bool>::value, bool>; enable_if_t<is_convertible<_Tp, bool>::value, bool>;
// [X.Y.8] Comparisons between optional values. // Comparisons between optional values.
template<typename _Tp> template<typename _Tp>
constexpr auto constexpr auto
operator==(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) operator==(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
...@@ -828,7 +821,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -828,7 +821,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return !__rhs || (static_cast<bool>(__lhs) && *__lhs >= *__rhs); return !__rhs || (static_cast<bool>(__lhs) && *__lhs >= *__rhs);
} }
// [X.Y.9] Comparisons with nullopt. // Comparisons with nullopt.
template<typename _Tp> template<typename _Tp>
constexpr bool constexpr bool
operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept
...@@ -889,7 +882,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -889,7 +882,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator>=(nullopt_t, const optional<_Tp>& __rhs) noexcept operator>=(nullopt_t, const optional<_Tp>& __rhs) noexcept
{ return !__rhs; } { return !__rhs; }
// [X.Y.10] Comparisons with value type. // Comparisons with value type.
template<typename _Tp> template<typename _Tp>
constexpr auto constexpr auto
operator==(const optional<_Tp>& __lhs, const _Tp& __rhs) operator==(const optional<_Tp>& __lhs, const _Tp& __rhs)
...@@ -962,7 +955,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -962,7 +955,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-> __optional_relop_t<decltype(declval<_Tp>() >= declval<_Tp>())> -> __optional_relop_t<decltype(declval<_Tp>() >= declval<_Tp>())>
{ return !__rhs || __lhs >= *__rhs; } { return !__rhs || __lhs >= *__rhs; }
// [X.Y.11] // Swap and creation functions.
template<typename _Tp> template<typename _Tp>
inline void inline void
swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs) swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs)
...@@ -984,7 +977,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -984,7 +977,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
make_optional(initializer_list<_Up> __il, _Args&&... __args) make_optional(initializer_list<_Up> __il, _Args&&... __args)
{ return optional<_Tp> { in_place, __il, std::forward<_Args>(__args)... }; } { return optional<_Tp> { in_place, __il, std::forward<_Args>(__args)... }; }
// [X.Y.12] // Hash.
template<typename _Tp> template<typename _Tp>
struct hash<optional<_Tp>> struct hash<optional<_Tp>>
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment