@@ -262,10 +262,10 @@ public:
262262 _LIBCPP_HIDE_FROM_ABI void swap (any& __rhs) _NOEXCEPT;
263263
264264 // 6.3.4 any observers
265- _LIBCPP_HIDE_FROM_ABI bool has_value () const _NOEXCEPT { return __h_ != nullptr ; }
265+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_value () const _NOEXCEPT { return __h_ != nullptr ; }
266266
267267# if _LIBCPP_HAS_RTTI
268- _LIBCPP_HIDE_FROM_ABI const type_info& type () const _NOEXCEPT {
268+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const type_info& type () const _NOEXCEPT {
269269 if (__h_) {
270270 return *static_cast <type_info const *>(this ->__call (_Action::_TypeInfo));
271271 } else {
@@ -492,17 +492,17 @@ inline _LIBCPP_HIDE_FROM_ABI void any::swap(any& __rhs) _NOEXCEPT {
492492inline _LIBCPP_HIDE_FROM_ABI void swap (any& __lhs, any& __rhs) _NOEXCEPT { __lhs.swap (__rhs); }
493493
494494template <class _Tp , class ... _Args>
495- inline _LIBCPP_HIDE_FROM_ABI any make_any (_Args&&... __args) {
495+ [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI any make_any (_Args&&... __args) {
496496 return any (in_place_type<_Tp>, std::forward<_Args>(__args)...);
497497}
498498
499499template <class _Tp , class _Up , class ... _Args>
500- inline _LIBCPP_HIDE_FROM_ABI any make_any (initializer_list<_Up> __il, _Args&&... __args) {
500+ [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI any make_any (initializer_list<_Up> __il, _Args&&... __args) {
501501 return any (in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
502502}
503503
504504template <class _ValueType >
505- inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast (any const & __v) {
505+ [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast (any const & __v) {
506506 using _RawValueType = __remove_cvref_t <_ValueType>;
507507 static_assert (is_constructible<_ValueType, _RawValueType const &>::value,
508508 " ValueType is required to be a const lvalue reference "
@@ -514,7 +514,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any const& __v) {
514514}
515515
516516template <class _ValueType >
517- inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast (any& __v) {
517+ [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast (any& __v) {
518518 using _RawValueType = __remove_cvref_t <_ValueType>;
519519 static_assert (is_constructible<_ValueType, _RawValueType&>::value,
520520 " ValueType is required to be an lvalue reference "
@@ -526,7 +526,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any& __v) {
526526}
527527
528528template <class _ValueType >
529- inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast (any&& __v) {
529+ [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast (any&& __v) {
530530 using _RawValueType = __remove_cvref_t <_ValueType>;
531531 static_assert (is_constructible<_ValueType, _RawValueType>::value,
532532 " ValueType is required to be an rvalue reference "
@@ -538,7 +538,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any&& __v) {
538538}
539539
540540template <class _ValueType >
541- inline _LIBCPP_HIDE_FROM_ABI add_pointer_t <add_const_t <_ValueType>> any_cast (any const * __any) _NOEXCEPT {
541+ [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI add_pointer_t <add_const_t <_ValueType>> any_cast (any const * __any) _NOEXCEPT {
542542 static_assert (!is_void_v<_ValueType>, " _ValueType may not be void." );
543543 static_assert (!is_reference<_ValueType>::value, " _ValueType may not be a reference." );
544544 return std::any_cast<_ValueType>(const_cast <any*>(__any));
@@ -555,7 +555,7 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction
555555}
556556
557557template <class _ValueType >
558- _LIBCPP_HIDE_FROM_ABI add_pointer_t <_ValueType> any_cast (any* __any) _NOEXCEPT {
558+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI add_pointer_t <_ValueType> any_cast (any* __any) _NOEXCEPT {
559559 using __any_imp::_Action;
560560 static_assert (!is_void_v<_ValueType>, " _ValueType may not be void." );
561561 static_assert (!is_reference<_ValueType>::value, " _ValueType may not be a reference." );
0 commit comments