1// -*- C++ -*- 2//===----------------------------------------------------------------------===// 3// 4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5// See https://llvm.org/LICENSE.txt for license information. 6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef _LIBCPP_ANY 11#define _LIBCPP_ANY 12 13/* 14 any synopsis 15 16namespace std { 17 18 class bad_any_cast : public bad_cast 19 { 20 public: 21 virtual const char* what() const noexcept; 22 }; 23 24 class any 25 { 26 public: 27 28 // 6.3.1 any construct/destruct 29 any() noexcept; 30 31 any(const any& other); 32 any(any&& other) noexcept; 33 34 template <class ValueType> 35 any(ValueType&& value); 36 37 ~any(); 38 39 // 6.3.2 any assignments 40 any& operator=(const any& rhs); 41 any& operator=(any&& rhs) noexcept; 42 43 template <class ValueType> 44 any& operator=(ValueType&& rhs); 45 46 // 6.3.3 any modifiers 47 template <class ValueType, class... Args> 48 decay_t<ValueType>& emplace(Args&&... args); 49 template <class ValueType, class U, class... Args> 50 decay_t<ValueType>& emplace(initializer_list<U>, Args&&...); 51 void reset() noexcept; 52 void swap(any& rhs) noexcept; 53 54 // 6.3.4 any observers 55 bool has_value() const noexcept; 56 const type_info& type() const noexcept; 57 }; 58 59 // 6.4 Non-member functions 60 void swap(any& x, any& y) noexcept; 61 62 template <class T, class ...Args> 63 any make_any(Args&& ...args); 64 template <class T, class U, class ...Args> 65 any make_any(initializer_list<U>, Args&& ...args); 66 67 template<class ValueType> 68 ValueType any_cast(const any& operand); 69 template<class ValueType> 70 ValueType any_cast(any& operand); 71 template<class ValueType> 72 ValueType any_cast(any&& operand); 73 74 template<class ValueType> 75 const ValueType* any_cast(const any* operand) noexcept; 76 template<class ValueType> 77 ValueType* any_cast(any* operand) noexcept; 78 79} // namespace std 80 81*/ 82 83#include <__assert> // all public C++ headers provide the assertion handler 84#include <__availability> 85#include <__config> 86#include <__utility/forward.h> 87#include <__utility/in_place.h> 88#include <__utility/move.h> 89#include <__utility/unreachable.h> 90#include <cstdlib> 91#include <initializer_list> 92#include <memory> 93#include <type_traits> 94#include <typeinfo> 95#include <version> 96 97#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES 98# include <chrono> 99#endif 100 101#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 102# pragma GCC system_header 103#endif 104 105namespace std { 106class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast 107{ 108public: 109 virtual const char* what() const _NOEXCEPT; 110}; 111} // namespace std 112 113_LIBCPP_BEGIN_NAMESPACE_STD 114 115#if _LIBCPP_STD_VER > 14 116 117_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY 118_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST 119void __throw_bad_any_cast() 120{ 121#ifndef _LIBCPP_NO_EXCEPTIONS 122 throw bad_any_cast(); 123#else 124 _VSTD::abort(); 125#endif 126} 127 128// Forward declarations 129class _LIBCPP_TEMPLATE_VIS any; 130 131template <class _ValueType> 132_LIBCPP_INLINE_VISIBILITY 133add_pointer_t<add_const_t<_ValueType>> 134any_cast(any const *) _NOEXCEPT; 135 136template <class _ValueType> 137_LIBCPP_INLINE_VISIBILITY 138add_pointer_t<_ValueType> any_cast(any *) _NOEXCEPT; 139 140namespace __any_imp 141{ 142 using _Buffer = aligned_storage_t<3*sizeof(void*), alignment_of<void*>::value>; 143 144 template <class _Tp> 145 using _IsSmallObject = integral_constant<bool 146 , sizeof(_Tp) <= sizeof(_Buffer) 147 && alignment_of<_Buffer>::value 148 % alignment_of<_Tp>::value == 0 149 && is_nothrow_move_constructible<_Tp>::value 150 >; 151 152 enum class _Action { 153 _Destroy, 154 _Copy, 155 _Move, 156 _Get, 157 _TypeInfo 158 }; 159 160 template <class _Tp> struct _SmallHandler; 161 template <class _Tp> struct _LargeHandler; 162 163 template <class _Tp> 164 struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo { static constexpr int __id = 0; }; 165 template <class _Tp> constexpr int __unique_typeinfo<_Tp>::__id; 166 167 template <class _Tp> 168 inline _LIBCPP_INLINE_VISIBILITY 169 constexpr const void* __get_fallback_typeid() { 170 return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id; 171 } 172 173 template <class _Tp> 174 inline _LIBCPP_INLINE_VISIBILITY 175 bool __compare_typeid(type_info const* __id, const void* __fallback_id) 176 { 177#if !defined(_LIBCPP_NO_RTTI) 178 if (__id && *__id == typeid(_Tp)) 179 return true; 180#endif 181 if (!__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>()) 182 return true; 183 return false; 184 } 185 186 template <class _Tp> 187 using _Handler = conditional_t< 188 _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>; 189 190} // namespace __any_imp 191 192class _LIBCPP_TEMPLATE_VIS any 193{ 194public: 195 // construct/destruct 196 _LIBCPP_INLINE_VISIBILITY 197 constexpr any() _NOEXCEPT : __h(nullptr) {} 198 199 _LIBCPP_INLINE_VISIBILITY 200 any(any const & __other) : __h(nullptr) 201 { 202 if (__other.__h) __other.__call(_Action::_Copy, this); 203 } 204 205 _LIBCPP_INLINE_VISIBILITY 206 any(any && __other) _NOEXCEPT : __h(nullptr) 207 { 208 if (__other.__h) __other.__call(_Action::_Move, this); 209 } 210 211 template < 212 class _ValueType 213 , class _Tp = decay_t<_ValueType> 214 , class = enable_if_t< 215 !is_same<_Tp, any>::value && 216 !__is_inplace_type<_ValueType>::value && 217 is_copy_constructible<_Tp>::value> 218 > 219 _LIBCPP_INLINE_VISIBILITY 220 any(_ValueType && __value); 221 222 template <class _ValueType, class ..._Args, 223 class _Tp = decay_t<_ValueType>, 224 class = enable_if_t< 225 is_constructible<_Tp, _Args...>::value && 226 is_copy_constructible<_Tp>::value 227 > 228 > 229 _LIBCPP_INLINE_VISIBILITY 230 explicit any(in_place_type_t<_ValueType>, _Args&&... __args); 231 232 template <class _ValueType, class _Up, class ..._Args, 233 class _Tp = decay_t<_ValueType>, 234 class = enable_if_t< 235 is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && 236 is_copy_constructible<_Tp>::value> 237 > 238 _LIBCPP_INLINE_VISIBILITY 239 explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args); 240 241 _LIBCPP_INLINE_VISIBILITY 242 ~any() { this->reset(); } 243 244 // assignments 245 _LIBCPP_INLINE_VISIBILITY 246 any & operator=(any const & __rhs) { 247 any(__rhs).swap(*this); 248 return *this; 249 } 250 251 _LIBCPP_INLINE_VISIBILITY 252 any & operator=(any && __rhs) _NOEXCEPT { 253 any(_VSTD::move(__rhs)).swap(*this); 254 return *this; 255 } 256 257 template < 258 class _ValueType 259 , class _Tp = decay_t<_ValueType> 260 , class = enable_if_t< 261 !is_same<_Tp, any>::value 262 && is_copy_constructible<_Tp>::value> 263 > 264 _LIBCPP_INLINE_VISIBILITY 265 any & operator=(_ValueType && __rhs); 266 267 template <class _ValueType, class ..._Args, 268 class _Tp = decay_t<_ValueType>, 269 class = enable_if_t< 270 is_constructible<_Tp, _Args...>::value && 271 is_copy_constructible<_Tp>::value> 272 > 273 _LIBCPP_INLINE_VISIBILITY 274 _Tp& emplace(_Args&&...); 275 276 template <class _ValueType, class _Up, class ..._Args, 277 class _Tp = decay_t<_ValueType>, 278 class = enable_if_t< 279 is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && 280 is_copy_constructible<_Tp>::value> 281 > 282 _LIBCPP_INLINE_VISIBILITY 283 _Tp& emplace(initializer_list<_Up>, _Args&&...); 284 285 // 6.3.3 any modifiers 286 _LIBCPP_INLINE_VISIBILITY 287 void reset() _NOEXCEPT { if (__h) this->__call(_Action::_Destroy); } 288 289 _LIBCPP_INLINE_VISIBILITY 290 void swap(any & __rhs) _NOEXCEPT; 291 292 // 6.3.4 any observers 293 _LIBCPP_INLINE_VISIBILITY 294 bool has_value() const _NOEXCEPT { return __h != nullptr; } 295 296#if !defined(_LIBCPP_NO_RTTI) 297 _LIBCPP_INLINE_VISIBILITY 298 const type_info & type() const _NOEXCEPT { 299 if (__h) { 300 return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo)); 301 } else { 302 return typeid(void); 303 } 304 } 305#endif 306 307private: 308 typedef __any_imp::_Action _Action; 309 using _HandleFuncPtr = void* (*)(_Action, any const *, any *, const type_info *, 310 const void* __fallback_info); 311 312 union _Storage { 313 constexpr _Storage() : __ptr(nullptr) {} 314 void * __ptr; 315 __any_imp::_Buffer __buf; 316 }; 317 318 _LIBCPP_INLINE_VISIBILITY 319 void * __call(_Action __a, any * __other = nullptr, 320 type_info const * __info = nullptr, 321 const void* __fallback_info = nullptr) const 322 { 323 return __h(__a, this, __other, __info, __fallback_info); 324 } 325 326 _LIBCPP_INLINE_VISIBILITY 327 void * __call(_Action __a, any * __other = nullptr, 328 type_info const * __info = nullptr, 329 const void* __fallback_info = nullptr) 330 { 331 return __h(__a, this, __other, __info, __fallback_info); 332 } 333 334 template <class> 335 friend struct __any_imp::_SmallHandler; 336 template <class> 337 friend struct __any_imp::_LargeHandler; 338 339 template <class _ValueType> 340 friend add_pointer_t<add_const_t<_ValueType>> 341 any_cast(any const *) _NOEXCEPT; 342 343 template <class _ValueType> 344 friend add_pointer_t<_ValueType> 345 any_cast(any *) _NOEXCEPT; 346 347 _HandleFuncPtr __h = nullptr; 348 _Storage __s; 349}; 350 351namespace __any_imp 352{ 353 template <class _Tp> 354 struct _LIBCPP_TEMPLATE_VIS _SmallHandler 355 { 356 _LIBCPP_INLINE_VISIBILITY 357 static void* __handle(_Action __act, any const * __this, any * __other, 358 type_info const * __info, const void* __fallback_info) 359 { 360 switch (__act) 361 { 362 case _Action::_Destroy: 363 __destroy(const_cast<any &>(*__this)); 364 return nullptr; 365 case _Action::_Copy: 366 __copy(*__this, *__other); 367 return nullptr; 368 case _Action::_Move: 369 __move(const_cast<any &>(*__this), *__other); 370 return nullptr; 371 case _Action::_Get: 372 return __get(const_cast<any &>(*__this), __info, __fallback_info); 373 case _Action::_TypeInfo: 374 return __type_info(); 375 } 376 __libcpp_unreachable(); 377 } 378 379 template <class ..._Args> 380 _LIBCPP_INLINE_VISIBILITY 381 static _Tp& __create(any & __dest, _Args&&... __args) { 382 typedef allocator<_Tp> _Alloc; 383 typedef allocator_traits<_Alloc> _ATraits; 384 _Alloc __a; 385 _Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s.__buf)); 386 _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); 387 __dest.__h = &_SmallHandler::__handle; 388 return *__ret; 389 } 390 391 private: 392 _LIBCPP_INLINE_VISIBILITY 393 static void __destroy(any & __this) { 394 typedef allocator<_Tp> _Alloc; 395 typedef allocator_traits<_Alloc> _ATraits; 396 _Alloc __a; 397 _Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf)); 398 _ATraits::destroy(__a, __p); 399 __this.__h = nullptr; 400 } 401 402 _LIBCPP_INLINE_VISIBILITY 403 static void __copy(any const & __this, any & __dest) { 404 _SmallHandler::__create(__dest, *static_cast<_Tp const *>( 405 static_cast<void const *>(&__this.__s.__buf))); 406 } 407 408 _LIBCPP_INLINE_VISIBILITY 409 static void __move(any & __this, any & __dest) { 410 _SmallHandler::__create(__dest, _VSTD::move( 411 *static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf)))); 412 __destroy(__this); 413 } 414 415 _LIBCPP_INLINE_VISIBILITY 416 static void* __get(any & __this, 417 type_info const * __info, 418 const void* __fallback_id) 419 { 420 if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id)) 421 return static_cast<void*>(&__this.__s.__buf); 422 return nullptr; 423 } 424 425 _LIBCPP_INLINE_VISIBILITY 426 static void* __type_info() 427 { 428#if !defined(_LIBCPP_NO_RTTI) 429 return const_cast<void*>(static_cast<void const *>(&typeid(_Tp))); 430#else 431 return nullptr; 432#endif 433 } 434 }; 435 436 template <class _Tp> 437 struct _LIBCPP_TEMPLATE_VIS _LargeHandler 438 { 439 _LIBCPP_INLINE_VISIBILITY 440 static void* __handle(_Action __act, any const * __this, 441 any * __other, type_info const * __info, 442 void const* __fallback_info) 443 { 444 switch (__act) 445 { 446 case _Action::_Destroy: 447 __destroy(const_cast<any &>(*__this)); 448 return nullptr; 449 case _Action::_Copy: 450 __copy(*__this, *__other); 451 return nullptr; 452 case _Action::_Move: 453 __move(const_cast<any &>(*__this), *__other); 454 return nullptr; 455 case _Action::_Get: 456 return __get(const_cast<any &>(*__this), __info, __fallback_info); 457 case _Action::_TypeInfo: 458 return __type_info(); 459 } 460 __libcpp_unreachable(); 461 } 462 463 template <class ..._Args> 464 _LIBCPP_INLINE_VISIBILITY 465 static _Tp& __create(any & __dest, _Args&&... __args) { 466 typedef allocator<_Tp> _Alloc; 467 typedef allocator_traits<_Alloc> _ATraits; 468 typedef __allocator_destructor<_Alloc> _Dp; 469 _Alloc __a; 470 unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1)); 471 _Tp * __ret = __hold.get(); 472 _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); 473 __dest.__s.__ptr = __hold.release(); 474 __dest.__h = &_LargeHandler::__handle; 475 return *__ret; 476 } 477 478 private: 479 480 _LIBCPP_INLINE_VISIBILITY 481 static void __destroy(any & __this){ 482 typedef allocator<_Tp> _Alloc; 483 typedef allocator_traits<_Alloc> _ATraits; 484 _Alloc __a; 485 _Tp * __p = static_cast<_Tp *>(__this.__s.__ptr); 486 _ATraits::destroy(__a, __p); 487 _ATraits::deallocate(__a, __p, 1); 488 __this.__h = nullptr; 489 } 490 491 _LIBCPP_INLINE_VISIBILITY 492 static void __copy(any const & __this, any & __dest) { 493 _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr)); 494 } 495 496 _LIBCPP_INLINE_VISIBILITY 497 static void __move(any & __this, any & __dest) { 498 __dest.__s.__ptr = __this.__s.__ptr; 499 __dest.__h = &_LargeHandler::__handle; 500 __this.__h = nullptr; 501 } 502 503 _LIBCPP_INLINE_VISIBILITY 504 static void* __get(any & __this, type_info const * __info, 505 void const* __fallback_info) 506 { 507 if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info)) 508 return static_cast<void*>(__this.__s.__ptr); 509 return nullptr; 510 511 } 512 513 _LIBCPP_INLINE_VISIBILITY 514 static void* __type_info() 515 { 516#if !defined(_LIBCPP_NO_RTTI) 517 return const_cast<void*>(static_cast<void const *>(&typeid(_Tp))); 518#else 519 return nullptr; 520#endif 521 } 522 }; 523 524} // namespace __any_imp 525 526 527template <class _ValueType, class _Tp, class> 528any::any(_ValueType && __v) : __h(nullptr) 529{ 530 __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_ValueType>(__v)); 531} 532 533template <class _ValueType, class ..._Args, class _Tp, class> 534any::any(in_place_type_t<_ValueType>, _Args&&... __args) { 535 __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); 536} 537 538template <class _ValueType, class _Up, class ..._Args, class _Tp, class> 539any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) { 540 __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); 541} 542 543template <class _ValueType, class, class> 544inline _LIBCPP_INLINE_VISIBILITY 545any & any::operator=(_ValueType && __v) 546{ 547 any(_VSTD::forward<_ValueType>(__v)).swap(*this); 548 return *this; 549} 550 551template <class _ValueType, class ..._Args, class _Tp, class> 552inline _LIBCPP_INLINE_VISIBILITY 553_Tp& any::emplace(_Args&&... __args) { 554 reset(); 555 return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); 556} 557 558template <class _ValueType, class _Up, class ..._Args, class _Tp, class> 559inline _LIBCPP_INLINE_VISIBILITY 560_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) { 561 reset(); 562 return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); 563} 564 565inline _LIBCPP_INLINE_VISIBILITY 566void any::swap(any & __rhs) _NOEXCEPT 567{ 568 if (this == &__rhs) 569 return; 570 if (__h && __rhs.__h) { 571 any __tmp; 572 __rhs.__call(_Action::_Move, &__tmp); 573 this->__call(_Action::_Move, &__rhs); 574 __tmp.__call(_Action::_Move, this); 575 } 576 else if (__h) { 577 this->__call(_Action::_Move, &__rhs); 578 } 579 else if (__rhs.__h) { 580 __rhs.__call(_Action::_Move, this); 581 } 582} 583 584// 6.4 Non-member functions 585 586inline _LIBCPP_INLINE_VISIBILITY 587void swap(any & __lhs, any & __rhs) _NOEXCEPT 588{ 589 __lhs.swap(__rhs); 590} 591 592template <class _Tp, class ..._Args> 593inline _LIBCPP_INLINE_VISIBILITY 594any make_any(_Args&&... __args) { 595 return any(in_place_type<_Tp>, _VSTD::forward<_Args>(__args)...); 596} 597 598template <class _Tp, class _Up, class ..._Args> 599inline _LIBCPP_INLINE_VISIBILITY 600any make_any(initializer_list<_Up> __il, _Args&&... __args) { 601 return any(in_place_type<_Tp>, __il, _VSTD::forward<_Args>(__args)...); 602} 603 604template <class _ValueType> 605inline _LIBCPP_INLINE_VISIBILITY 606_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST 607_ValueType any_cast(any const & __v) 608{ 609 using _RawValueType = __uncvref_t<_ValueType>; 610 static_assert(is_constructible<_ValueType, _RawValueType const &>::value, 611 "ValueType is required to be a const lvalue reference " 612 "or a CopyConstructible type"); 613 auto __tmp = _VSTD::any_cast<add_const_t<_RawValueType>>(&__v); 614 if (__tmp == nullptr) 615 __throw_bad_any_cast(); 616 return static_cast<_ValueType>(*__tmp); 617} 618 619template <class _ValueType> 620inline _LIBCPP_INLINE_VISIBILITY 621_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST 622_ValueType any_cast(any & __v) 623{ 624 using _RawValueType = __uncvref_t<_ValueType>; 625 static_assert(is_constructible<_ValueType, _RawValueType &>::value, 626 "ValueType is required to be an lvalue reference " 627 "or a CopyConstructible type"); 628 auto __tmp = _VSTD::any_cast<_RawValueType>(&__v); 629 if (__tmp == nullptr) 630 __throw_bad_any_cast(); 631 return static_cast<_ValueType>(*__tmp); 632} 633 634template <class _ValueType> 635inline _LIBCPP_INLINE_VISIBILITY 636_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST 637_ValueType any_cast(any && __v) 638{ 639 using _RawValueType = __uncvref_t<_ValueType>; 640 static_assert(is_constructible<_ValueType, _RawValueType>::value, 641 "ValueType is required to be an rvalue reference " 642 "or a CopyConstructible type"); 643 auto __tmp = _VSTD::any_cast<_RawValueType>(&__v); 644 if (__tmp == nullptr) 645 __throw_bad_any_cast(); 646 return static_cast<_ValueType>(_VSTD::move(*__tmp)); 647} 648 649template <class _ValueType> 650inline _LIBCPP_INLINE_VISIBILITY 651add_pointer_t<add_const_t<_ValueType>> 652any_cast(any const * __any) _NOEXCEPT 653{ 654 static_assert(!is_reference<_ValueType>::value, 655 "_ValueType may not be a reference."); 656 return _VSTD::any_cast<_ValueType>(const_cast<any *>(__any)); 657} 658 659template <class _RetType> 660inline _LIBCPP_INLINE_VISIBILITY 661_RetType __pointer_or_func_cast(void* __p, /*IsFunction*/false_type) noexcept { 662 return static_cast<_RetType>(__p); 663} 664 665template <class _RetType> 666inline _LIBCPP_INLINE_VISIBILITY 667_RetType __pointer_or_func_cast(void*, /*IsFunction*/true_type) noexcept { 668 return nullptr; 669} 670 671template <class _ValueType> 672_LIBCPP_HIDE_FROM_ABI 673add_pointer_t<_ValueType> 674any_cast(any * __any) _NOEXCEPT 675{ 676 using __any_imp::_Action; 677 static_assert(!is_reference<_ValueType>::value, 678 "_ValueType may not be a reference."); 679 typedef typename add_pointer<_ValueType>::type _ReturnType; 680 if (__any && __any->__h) { 681 void *__p = __any->__call(_Action::_Get, nullptr, 682#if !defined(_LIBCPP_NO_RTTI) 683 &typeid(_ValueType), 684#else 685 nullptr, 686#endif 687 __any_imp::__get_fallback_typeid<_ValueType>()); 688 return _VSTD::__pointer_or_func_cast<_ReturnType>( 689 __p, is_function<_ValueType>{}); 690 } 691 return nullptr; 692} 693 694#endif // _LIBCPP_STD_VER > 14 695 696_LIBCPP_END_NAMESPACE_STD 697 698#endif // _LIBCPP_ANY 699