std::experimental(3cxx)
๐ธ std::experimental โ ok bestie, welcome to the 3cxx zone ๐ฆ
So this is the manual page for std::experimental (that's the page header, std::experimental(3cxx), in case you were wondering ๐
). Lowkey it's a namespace, and here's the whole vibe:
โจ NAME โจ
std::experimental โ the namespace where all the features living in the ISO Technical Specifications hang out. It's giving "the beta-testing era of the standard library," no cap ๐
๐ SYNOPSIS ๐
๐ Classes
class anyโ a container of any type, but type-safe about it. Iconic behaviour honestly ๐ซถclass bad_any_castโ the exception class that gets thrown when anany_castgoes wrong. It's giving "oops, wrong type" energy ๐ญclass bad_optional_accessโ the exception class thrown when you dereference anoptionalobject that's disengaged (aka empty). Bestie, do the vibe check first ๐class basic_string_viewโ a non-owning reference to a string. It's literally just looking respectfully ๐struct in_place_tโ tag type for in-place construction โจstruct nullopt_tโ tag type used to disengageoptionalobjects ๐class optionalโ class template for optional values. Main character energy fr ๐class ostream_joinerโ an output iterator that inserts a delimiter between elements. Obsessed with the separator aesthetic ๐struct owner_less< shared_ptr< _Tp > >โ the partial specialization ofowner_lessforshared_ptr๐struct owner_less< weak_ptr< _Tp > >โ the partial specialization ofowner_lessforweak_ptr๐ธclass propagate_constโ a const-propagating wrapper. It carries that const energy everywhere it goes โญ
๐ Typedefs
These ones are long, so I'm giving them their own little spotlight, per usual ๐
template<typename _RAIter , typename _Hash , typename _Pred , typename
_Val = typename iterator_traits<_RAIter>::value_type, typename
_Diff = typename iterator_traits<_RAIter>::difference_type> using
__boyer_moore_base_t = std::__conditional_t< std::__is_byte_like<
_Val, _Pred >::value, __boyer_moore_array_base< _Diff, 256, _Pred >,
__boyer_moore_map_base< _Val, _Diff, _Hash, _Pred > >
That's __boyer_moore_base_t โ tbh it's a whole mouthful but she's doing her best ๐ซถ
template<typename _Tp > using __propagate_const_elem_type =
remove_reference_t< decltype(*std::declval< _Tp & >())>
That one's __propagate_const_elem_type โ yes, the template gymnastics are real, and yes, it slays โจ
Then we've got the shorter ones, all copy-paste exact and cute:
using erased_type = std::__erased_typeโ the erased type, slay ๐ (well, erased, not dead โ don't come for me)using string_view = basic_string_view< char >โ thecharflavour ofbasic_string_view๐using u16string_view = basic_string_view< char16_t >โ thechar16_tflavour ๐ธusing u32string_view = basic_string_view< char32_t >โ thechar32_tflavour ๐ฆusing wstring_view = basic_string_view< wchar_t >โ thewchar_tflavour ๐
ok that's the classes-and-typedefs part sorted, and there's more coming so don't go anywhere ๐
โจ Functions โจ
okay bestie, this is the big one โ the whole function roster. it's long, it's alphabetical-ish, and yes we're doing all of it. no skipping. grab a snack ๐
template<typename _Fn , typename _Tuple , std::size_t... _Idx> constexpr decltype(auto) __apply_impl (_Fn &&__f, _Tuple &&__t, std::index_sequence< _Idx... >)โ internal helper, double underscore club, you're not supposed to touch it but she's here and she's doing her job ๐template<typename _Tp , size_t _Nm, size_t... _Idx> constexpr array< remove_cv_t< _Tp >, _Nm > __to_array (_Tp(&__a)[_Nm], index_sequence< _Idx... >)โ another internal, the behind-the-scenes friend doing the heavy lifting ๐ซถstd::default_random_engine & _S_randint_engine ()โ internal engine accessor, living that reserved-name life โจtemplate<typename _ValueType > _ValueType any_cast (const any &__any)โ Access the contained object. literally just pulls the thing back out of yourany, iconic behavior ๐
okay next up, the apply + shared_ptr atomic squad, because std::experimental said "what if shared_ptr was atomic, but like, a whole list of functions about it" ๐ญ
template<typename _Fn , typename _Tuple > constexpr decltype(auto) apply (_Fn &&__f, _Tuple &&__t)โ call__fwith the tuple__tunpacked, the classic โจtemplate<typename _Tp > bool atomic_compare_exchange_strong (shared_ptr< _Tp > *__p, shared_ptr< _Tp > *__v, shared_ptr< _Tp > __w)โ strong CAS on ashared_ptrtemplate<typename _Tp > bool atomic_compare_exchange_strong_explicit (shared_ptr< _Tp > *__p, shared_ptr< _Tp > *__v, shared_ptr< _Tp > __w, memory_order __success, memory_order __failure)โ same, but explicit about yourmemory_order __success/__failure, she communicates ๐ธtemplate<typename _Tp > bool atomic_compare_exchange_weak (shared_ptr< _Tp > *__p, shared_ptr< _Tp > *__v, shared_ptr< _Tp > __w)โ the weak version, may fail spuriously, that's just her vibe ๐template<typename _Tp > bool atomic_compare_exchange_weak_explicit (shared_ptr< _Tp > *__p, shared_ptr< _Tp > *__v, shared_ptr< _Tp > __w, memory_order __success, memory_order __failure)โ weak + explicit, the full combo meal ๐template<typename _Tp > void atomic_exchange (shared_ptr< _Tp > *__p, shared_ptr< _Tp > __r)โ swap the pointer out atomicallytemplate<typename _Tp > shared_ptr< _Tp > atomic_exchange_explicit (const shared_ptr< _Tp > *__p, shared_ptr< _Tp > __r, memory_order __mo)โ same energy, now with amemory_order __moof your choosing โญtemplate<typename _Tp > bool atomic_is_lock_free (const shared_ptr< _Tp > *__p)โ asks the real question: is it lock free? ๐template<typename _Tp > shared_ptr< _Tp > atomic_load (const shared_ptr< _Tp > *__p)โ load it atomicallytemplate<typename _Tp > shared_ptr< _Tp > atomic_load_explicit (const shared_ptr< _Tp > *__p, memory_order __mo)โ load, but explicit, with__motemplate<typename _Tp > void atomic_store (shared_ptr< _Tp > *__p, shared_ptr< _Tp > __r)โ store it atomicallytemplate<typename _Tp > shared_ptr< _Tp > atomic_store_explicit (const shared_ptr< _Tp > *__p, shared_ptr< _Tp > __r, memory_order __mo)โ store, explicit,__mo, you know the drill ๐
pointer cast besties ๐ฆ
template<typename _Tp , typename _Tp1 > shared_ptr< _Tp > const_pointer_cast (const shared_ptr< _Tp1 > &__r) noexceptโ casts away const-ness on ashared_ptr, and yes she'snoexcepttemplate<typename _Tp , typename _Tp1 > shared_ptr< _Tp > dynamic_pointer_cast (const shared_ptr< _Tp1 > &__r) noexceptโ the dynamic_cast equivalent forshared_ptr, alsonoexcept
now the erase / erase_if era. this is the part where the page just goes off with template parameters, and honestly? she ate ๐ฅ
template<typename _CharT , typename _Traits , typename _Alloc , typename _Up > void erase (basic_string< _CharT, _Traits, _Alloc > &__cont, const _Up &__value)โ erase matching values from abasic_stringtemplate<typename _Tp , typename _Alloc , typename _Up > void erase (deque< _Tp, _Alloc > &__cont, const _Up &__value)โ erase matching values from adequetemplate<typename _Tp , typename _Alloc , typename _Up > void erase (forward_list< _Tp, _Alloc > &__cont, const _Up &__value)โ erase matching values from aforward_listtemplate<typename _Tp , typename _Alloc , typename _Up > void erase (list< _Tp, _Alloc > &__cont, const _Up &__value)โ erase matching values from alisttemplate<typename _Tp , typename _Alloc , typename _Up > void erase (vector< _Tp, _Alloc > &__cont, const _Up &__value)โ erase matching values from avector
and the predicate versions, aka erase_if, the whole squad ๐
template<typename _CharT , typename _Traits , typename _Alloc , typename _Predicate > void erase_if (basic_string< _CharT, _Traits, _Alloc > &__cont, _Predicate __pred)โ erase everything matching__predfrom abasic_stringtemplate<typename _Tp , typename _Alloc , typename _Predicate > void erase_if (deque< _Tp, _Alloc > &__cont, _Predicate __pred)โ same, fordequetemplate<typename _Tp , typename _Alloc , typename _Predicate > void erase_if (forward_list< _Tp, _Alloc > &__cont, _Predicate __pred)โ same, forforward_listtemplate<typename _Tp , typename _Alloc , typename _Predicate > void erase_if (list< _Tp, _Alloc > &__cont, _Predicate __pred)โ same, forlisttemplate<typename _Key , typename _Tp , typename _Compare , typename _Alloc , typename _Predicate > void erase_if (map< _Key, _Tp, _Compare, _Alloc > &__cont, _Predicate __pred)โ same, formaptemplate<typename _Key , typename _Tp , typename _Compare , typename _Alloc , typename _Predicate > void erase_if (multimap< _Key, _Tp, _Compare, _Alloc > &__cont, _Predicate __pred)โ same, formultimaptemplate<typename _Key , typename _Compare , typename _Alloc , typename _Predicate > void erase_if (multiset< _Key, _Compare, _Alloc > &__cont, _Predicate __pred)โ same, formultisettemplate<typename _Key , typename _Compare , typename _Alloc , typename _Predicate > void erase_if (set< _Key, _Compare, _Alloc > &__cont, _Predicate __pred)โ same, forsettemplate<typename _Key , typename _Tp , typename _Hash , typename _CPred , typename _Alloc , typename _Predicate > void erase_if (unordered_map< _Key, _Tp, _Hash, _CPred, _Alloc > &__cont, _Predicate __pred)โ same, forunordered_maptemplate<typename _Key , typename _Tp , typename _Hash , typename _CPred , typename _Alloc , typename _Predicate > void erase_if (unordered_multimap< _Key, _Tp, _Hash, _CPred, _Alloc > &__cont, _Predicate __pred)โ same, forunordered_multimaptemplate<typename _Key , typename _Hash , typename _CPred , typename _Alloc , typename _Predicate > void erase_if (unordered_multiset< _Key, _Hash, _CPred, _Alloc > &__cont, _Predicate __pred)โ same, forunordered_multisettemplate<typename _Key , typename _Hash , typename _CPred , typename _Alloc , typename _Predicate > void erase_if (unordered_set< _Key, _Hash, _CPred, _Alloc > &__cont, _Predicate __pred)โ same, forunordered_settemplate<typename _Tp , typename _Alloc , typename _Predicate > void erase_if (vector< _Tp, _Alloc > &__cont, _Predicate __pred)โ same, forvector
okay that was a lot but we got through it together ๐ซถ
template<typename _Mn , typename _Nn > constexpr common_type_t< _Mn, _Nn > gcd (_Mn __m, _Nn __n) noexceptโ Greatest common divisor. yes, the math one, she'sconstexprANDnoexcept, overachiever โจtemplate<typename _Del , typename _Tp > _Del * get_deleter (const shared_ptr< _Tp > &__p) noexceptโ C++14 20.8.2.2.10. (the original literally cites that, so here it is verbatim, iykyk ๐ )template<typename _Tp > constexpr const _Tp & get_underlying (const propagate_const< _Tp > &__pt) noexceptโ grab the underlying thing out of apropagate_const, const flavoredtemplate<typename _Tp > constexpr _Tp & get_underlying (propagate_const< _Tp > &__pt) noexceptโ same, non-const flavoredtemplate<typename _Mn , typename _Nn > constexpr common_type_t< _Mn, _Nn > lcm (_Mn __m, _Nn __n)โ Least common multiple. sister ofgcd, nonoexcepton this one, notice that ๐
make_ function factories, my beloved ๐
template<typename _Dest = void, typename... _Types> constexpr array< typename __make_array_elem< _Dest, _Types... >::type, sizeof...(_Types)> make_array (_Types &&... __t)โ Create astd::arrayfrom a variable-length list of arguments. like, the most convenient thing ever, obsessed ๐template<typename _RAIter , typename _Hash = std::hash<typename std::iterator_traits<_RAIter>::value_type>, typename _BinaryPredicate = equal_to<>> boyer_moore_horspool_searcher< _RAIter, _Hash, _BinaryPredicate > make_boyer_moore_horspool_searcher (_RAIter __pat_first, _RAIter __pat_last, _Hash __hf=_Hash(), _BinaryPredicate __pred=_BinaryPredicate())โ Generator function forboyer_moore_horspool_searcher. note the defaults:__hf=_Hash()and__pred=_BinaryPredicate()๐ธtemplate<typename _RAIter , typename _Hash = std::hash<typename std::iterator_traits<_RAIter>::value_type>, typename _BinaryPredicate = equal_to<>> boyer_moore_searcher< _RAIter, _Hash, _BinaryPredicate > make_boyer_moore_searcher (_RAIter __pat_first, _RAIter __pat_last, _Hash __hf=_Hash(), _BinaryPredicate __pred=_BinaryPredicate())โ Generator function forboyer_moore_searcher. the non-horspool one, equally iconic ๐template<typename _ForwardIterator , typename _BinaryPredicate = std::equal_to<>> default_searcher< _ForwardIterator, _BinaryPredicate > make_default_searcher (_ForwardIterator __pat_first, _ForwardIterator __pat_last, _BinaryPredicate __pred=_BinaryPredicate())โ Generator function fordefault_searcher. the og, no fancy algorithm, just vibes โญtemplate<typename _Tp > observer_ptr< _Tp > make_observer (_Tp *__p) noexceptโ wraps your raw pointer into anobserver_ptr,noexcept, no captemplate<typename _CharT , typename _Traits , typename _DelimT > ostream_joiner< decay_t< _DelimT >, _CharT, _Traits > make_ostream_joiner (basic_ostream< _CharT, _Traits > &__os, _DelimT &&__delimiter)โ Object generator forostream_joiner. so you can print a range with delimiters and serve looks while doing it ๐
okay now the operator wall. comparison operators for DAYS. stay with me bestie ๐ญ
template<typename _CharT , typename _Traits > constexpr bool operator!= (__type_identity_t< basic_string_view< _CharT, _Traits > > __x, basic_string_view< _CharT, _Traits > __y) noexceptโstring_viewnot-equal, identity-typed left sidetemplate<typename _CharT , typename _Traits > constexpr bool operator!= (basic_string_view< _CharT, _Traits > __x, __type_identity_t< basic_string_view< _CharT, _Traits > > __y) noexceptโ and the mirrored version, because overload resolution said "both" ๐ฆtemplate<typename _CharT , typename _Traits > constexpr bool operator!= (basic_string_view< _CharT, _Traits > __x, basic_string_view< _CharT, _Traits > __y) noexceptโ plain oldstring_view!=string_viewtemplate<typename _Tp , typename _Up > constexpr bool operator!= (const _Tp &__t, const propagate_const< _Up > &__pu)โpropagate_constmixed comparison, left side rawtemplate<typename _Tp , typename _Up > constexpr bool operator!= (const propagate_const< _Tp > &__pt, const _Up &__u)โ mixed comparison,propagate_conston the lefttemplate<typename _Tp , typename _Up > constexpr bool operator!= (const propagate_const< _Tp > &__pt, const propagate_const< _Up > &__pu)โ both sidespropagate_consttemplate<typename _Tp > constexpr bool operator!= (const propagate_const< _Tp > &__pt, nullptr_t)โpropagate_constvsnullptr_ttemplate<typename _Tp > bool operator!= (const shared_ptr< _Tp > &__a, nullptr_t) noexceptโshared_ptrvsnullptr_t,noexcepttemplate<typename _Tp1 , typename _Tp2 > bool operator!= (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b) noexceptโ twoshared_ptrs that aren't even the same type, still comparing, queen behavior ๐template<typename _Tp > constexpr bool operator!= (nullptr_t, const propagate_const< _Tp > &__pu)โnullptr_ton the left this timetemplate<typename _Tp > bool operator!= (nullptr_t, const shared_ptr< _Tp > &__a) noexceptโ ditto,shared_ptr,noexcepttemplate<typename _Tp > bool operator!= (nullptr_t, observer_ptr< _Tp > __p) noexceptโnullptr_tvsobserver_ptr, by value,noexcepttemplate<typename _Tp > bool operator!= (observer_ptr< _Tp > __p, nullptr_t) noexceptโ and the other directiontemplate<typename _Tp , typename _Up > bool operator!= (observer_ptr< _Tp > __p1, observer_ptr< _Up > __p2)โ twoobserver_ptrs, two types, nonoexcepthere, read into that what you will ๐
then the literal operator, four flavors of it:
constexpr basic_string_view< char > operator""sv (const char *__str, size_t __len) noexceptโ thesvliteral forcharconstexpr basic_string_view< char16_t > operator""sv (const char16_t *__str, size_t __len) noexceptโ thesvliteral forchar16_tconstexpr basic_string_view< char32_t > operator""sv (const char32_t *__str, size_t __len) noexceptโ thesvliteral forchar32_tconstexpr basic_string_view< wchar_t > operator""sv (const wchar_t *__str, size_t __len) noexceptโ thesvliteral forwchar_t
all four constexpr, all four noexcept, all four taking __str and __len, periodt โจ
aaaaand the < crew starts (we're cutting off mid-squad, don't worry, more coming):
template<typename _CharT , typename _Traits > constexpr bool operator< (__type_identity_t< basic_string_view< _CharT, _Traits > > __x, basic_string_view< _CharT, _Traits > __y) noexceptโstring_viewless-than, identity-typed lefttemplate<typename _CharT , typename _Traits > constexpr bool operator< (basic_string_view< _CharT, _Traits > __x, __type_identity_t< basic_string_view< _CharT, _Traits > > __y) noexceptโ and the mirrortemplate<typename _CharT , typename _Traits > constexpr bool operator< (basic_string_view< _CharT, _Traits > __x, basic_string_view< _CharT, _Traits > __y) noexceptโ the plain onetemplate<typename _Tp , typename _Up > constexpr bool operator< (const _Tp &__t, const propagate_const< _Up > &__pu)โ raw vspropagate_consttemplate<typename _Tp , typename _Up > constexpr bool operator< (const propagate_const< _Tp > &__pt, const _Up &__u)โpropagate_constvs rawtemplate<typename _Tp , typename _Up > constexpr bool operator< (const propagate_const< _Tp > &__pt, const propagate_const< _Up > &__pu)โpropagate_constvspropagate_const
okay so we're still deep in the synopsis trenches bestie, and this stretch is the comparison-operator wall ๐
it runs alphabetically from operator< all the way down to the any_cast squad, and ngl it's a lot of signatures โ so let's just vibe through them together, one family at a time ๐ซถ
๐ฅ the operator< era ๐ฅ
four of them, no cap:
template<typename _Tp > bool operator< (const shared_ptr< _Tp > &__a, nullptr_t) noexcept
template<typename _Tp1 , typename _Tp2 > bool operator< (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b) noexcept
template<typename _Tp > bool operator< (nullptr_t, const shared_ptr< _Tp > &__a) noexcept
template<typename _Tp , typename _Up > bool operator< (observer_ptr< _Tp > __p1, observer_ptr< _Up > __p2)
so you got shared_ptr vs nullptr_t (both directions), shared_ptr vs shared_ptr, and observer_ptr vs observer_ptr. The shared_ptr ones are all noexcept, the observer one is just chillin' without it. That's it, that's the whole blurb โ the manpage gives zero extra commentary here so I'm not gonna invent any ๐
๐ค operator<< ๐ค
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & operator<< (basic_ostream< _CharT, _Traits > &__os, basic_string_view< _CharT, _Traits > __str)
template<typename _Ch , typename _Tr , typename _Tp > std::basic_ostream< _Ch, _Tr > & operator<< (std::basic_ostream< _Ch, _Tr > &__os, const shared_ptr< _Tp > &__p)
two overloads, both returning a ref to the stream so you can keep chaining like the icon you are โจ note that the first one uses _CharT / _Traits and the second one uses _Ch / _Tr โ yes, they're spelled differently in the source, and yes, I'm keeping them exactly as-is ๐
๐ฆ operator<= (ten of them, buckle up) ๐ฆ
first the basic_string_view trio:
template<typename _CharT , typename _Traits > constexpr bool operator<= (__type_identity_t< basic_string_view< _CharT, _Traits > > __x, basic_string_view< _CharT, _Traits > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator<= (basic_string_view< _CharT, _Traits > __x, __type_identity_t< basic_string_view< _CharT, _Traits > > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator<= (basic_string_view< _CharT, _Traits > __x, basic_string_view< _CharT, _Traits > __y) noexcept
then the propagate_const trio:
template<typename _Tp , typename _Up > constexpr bool operator<= (const _Tp &__t, const propagate_const< _Up > &__pu)
template<typename _Tp , typename _Up > constexpr bool operator<= (const propagate_const< _Tp > &__pt, const _Up &__u)
template<typename _Tp , typename _Up > constexpr bool operator<= (const propagate_const< _Tp > &__pt, const propagate_const< _Up > &__pu)
then the shared_ptr trio:
template<typename _Tp > bool operator<= (const shared_ptr< _Tp > &__a, nullptr_t) noexcept
template<typename _Tp1 , typename _Tp2 > bool operator<= (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b) noexcept
template<typename _Tp > bool operator<= (nullptr_t, const shared_ptr< _Tp > &__a) noexcept
and the lone observer_ptr one to close it out:
template<typename _Tp , typename _Up > bool operator<= (observer_ptr< _Tp > __p1, observer_ptr< _Up > __p2)
see the pattern? _Tp / _Up, __t / __u, __pt / __pu, __a / __b, __x / __y โ the naming is immaculate and consistent and I respect it deeply ๐ง
๐ operator== (the big one, fourteen whole overloads) ๐
okay bestie, this is the main character of the comparison section. fourteen entries. deep breath ๐
the basic_string_view trio, with that __type_identity_t wrapper doing its thing:
template<typename _CharT , typename _Traits > constexpr bool operator== (__type_identity_t< basic_string_view< _CharT, _Traits > > __x, basic_string_view< _CharT, _Traits > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator== (basic_string_view< _CharT, _Traits > __x, __type_identity_t< basic_string_view< _CharT, _Traits > > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator== (basic_string_view< _CharT, _Traits > __x, basic_string_view< _CharT, _Traits > __y) noexcept
the propagate_const squad โ a whole four here, including the nullptr_t one in each direction:
template<typename _Tp , typename _Up > constexpr bool operator== (const _Tp &__t, const propagate_const< _Up > &__pu)
template<typename _Tp , typename _Up > constexpr bool operator== (const propagate_const< _Tp > &__pt, const _Up &__u)
template<typename _Tp , typename _Up > constexpr bool operator== (const propagate_const< _Tp > &__pt, const propagate_const< _Up > &__pu)
template<typename _Tp > constexpr bool operator== (const propagate_const< _Tp > &__pt, nullptr_t)
template<typename _Tp > constexpr bool operator== (nullptr_t, const propagate_const< _Tp > &__pu)
(okay that's five, math is hard, but you see the shape of it ๐ญ)
the shared_ptr pair:
template<typename _Tp > bool operator== (const shared_ptr< _Tp > &__a, nullptr_t) noexcept
template<typename _Tp1 , typename _Tp2 > bool operator== (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b) noexcept
template<typename _Tp > bool operator== (nullptr_t, const shared_ptr< _Tp > &__a) noexcept
(three! three. fine.)
the observer_ptr trio, which is the only one here that gets both nullptr_t directions plus the pointer-vs-pointer compare:
template<typename _Tp > bool operator== (nullptr_t, observer_ptr< _Tp > __p) noexcept
template<typename _Tp > bool operator== (observer_ptr< _Tp > __p, nullptr_t) noexcept
template<typename _Tp , typename _Up > bool operator== (observer_ptr< _Tp > __p1, observer_ptr< _Up > __p2)
lowkey obsessed with how nullptr_t comparisons are noexcept everywhere while the observer_ptr-vs-observer_ptr one just isn't ๐ธ
๐ operator> and operator>= โ the mirror twins ๐
operator> is the exact same shape as operator<=, ten entries, same __x / __y / __t / __u / __pt / __pu / __a / __b naming, just the other direction:
template<typename _CharT , typename _Traits > constexpr bool operator> (__type_identity_t< basic_string_view< _CharT, _Traits > > __x, basic_string_view< _CharT, _Traits > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator> (basic_string_view< _CharT, _Traits > __x, __type_identity_t< basic_string_view< _CharT, _Traits > > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator> (basic_string_view< _CharT, _Traits > __x, basic_string_view< _CharT, _Traits > __y) noexcept
template<typename _Tp , typename _Up > constexpr bool operator> (const _Tp &__t, const propagate_const< _Up > &__pu)
template<typename _Tp , typename _Up > constexpr bool operator> (const propagate_const< _Tp > &__pt, const _Up &__u)
template<typename _Tp , typename _Up > constexpr bool operator> (const propagate_const< _Tp > &__pt, const propagate_const< _Up > &__pu)
template<typename _Tp > bool operator> (const shared_ptr< _Tp > &__a, nullptr_t) noexcept
template<typename _Tp1 , typename _Tp2 > bool operator> (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b) noexcept
template<typename _Tp > bool operator> (nullptr_t, const shared_ptr< _Tp > &__a) noexcept
template<typename _Tp , typename _Up > bool operator> (observer_ptr< _Tp > __p1, observer_ptr< _Up > __p2)
and operator>=, also ten, also identical in shape:
template<typename _CharT , typename _Traits > constexpr bool operator>= (__type_identity_t< basic_string_view< _CharT, _Traits > > __x, basic_string_view< _CharT, _Traits > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator>= (basic_string_view< _CharT, _Traits > __x, __type_identity_t< basic_string_view< _CharT, _Traits > > __y) noexcept
template<typename _CharT , typename _Traits > constexpr bool operator>= (basic_string_view< _CharT, _Traits > __x, basic_string_view< _CharT, _Traits > __y) noexcept
template<typename _Tp , typename _Up > constexpr bool operator>= (const _Tp &__t, const propagate_const< _Up > &__pu)
template<typename _Tp , typename _Up > constexpr bool operator>= (const propagate_const< _Tp > &__pt, const _Up &__u)
template<typename _Tp , typename _Up > constexpr bool operator>= (const propagate_const< _Tp > &__pt, const propagate_const< _Up > &__pu)
template<typename _Tp > bool operator>= (const shared_ptr< _Tp > &__a, nullptr_t) noexcept
template<typename _Tp1 , typename _Tp2 > bool operator>= (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b) noexcept
template<typename _Tp > bool operator>= (nullptr_t, const shared_ptr< _Tp > &__a) noexcept
template<typename _Tp , typename _Up > bool operator>= (observer_ptr< _Tp > __p1, observer_ptr< _Up > __p2)
periodt. comparison operators: done. we survived ๐ฅ
๐ randint, casts, reseed ๐
template<typename _IntType > _IntType randint (_IntType __a, _IntType __b)
a template randint taking _IntType twice. no blurb given, so no blurb invented ๐
template<typename _Tp , typename _Tp1 > shared_ptr< _Tp > reinterpret_pointer_cast (const shared_ptr< _Tp1 > &__r) noexcept
reinterpret_pointer_cast, marked noexcept, and it takes the source as _Tp1 and gives you back a shared_ptr< _Tp >.
void reseed ()
void reseed (default_random_engine::result_type __value)
two overloads of reseed โ one takes nothing, one takes a default_random_engine::result_type named __value. ๐
๐ธ sample, search, shuffle ๐ธ
template<typename _PopulationIterator , typename _SampleIterator , typename _Distance > _SampleIterator sample (_PopulationIterator __first, _PopulationIterator __last, _SampleIterator __out, _Distance __n)
no generator version. and then the generator version, which actually gets a description in the source:
template<typename _PopulationIterator , typename _SampleIterator , typename _Distance , typename _UniformRandomNumberGenerator > _SampleIterator sample (_PopulationIterator __first, _PopulationIterator __last, _SampleIterator __out, _Distance __n, _UniformRandomNumberGenerator &&__g)
Take a random sample from a population.
yeah that's the line, straight from the page ๐ซถ
template<typename _ForwardIterator , typename _Searcher > _ForwardIterator search (_ForwardIterator __first, _ForwardIterator __last, const _Searcher &__searcher)
search with a searcher object โ the searcher is the const _Searcher &__searcher param, and you get a _ForwardIterator back.
template<typename _RandomAccessIterator > void shuffle (_RandomAccessIterator __first, _RandomAccessIterator __last)
shuffle takes a random-access range and returns void. no description attached, moving on ๐ฆ
๐ the pointer casts ๐
template<typename _Tp , typename _Tp1 > shared_ptr< _Tp > static_pointer_cast (const shared_ptr< _Tp1 > &__r) noexcept
static_pointer_cast, noexcept, source _Tp1 โ target _Tp. iconic, no notes.
โญ the swap family โญ
first up, the any one โ and this one does come with a blurb:
void swap (any &__x, any &__y) noexcept
Exchange the states of two any objects.
then the observer_ptr one, which only swaps matching _Tps:
template<typename _Tp > void swap (observer_ptr< _Tp > &__p1, observer_ptr< _Tp > &__p2) noexcept
then the propagate_const one, which is the fancy diva of the group โ look at that enable_if_t gate and the noexcept(...) depending on __is_nothrow_swappable< _Tp >::value:
template<typename _Tp > constexpr enable_if_t< __is_swappable< _Tp >::value, void > swap (propagate_const< _Tp > &__pt, propagate_const< _Tp > &__pt2) noexcept(__is_nothrow_swappable< _Tp >::value)
then the shared_ptr and weak_ptr classics, both noexcept:
template<typename _Tp > void swap (shared_ptr< _Tp > &__a, shared_ptr< _Tp > &__b) noexcept
template<typename _Tp > void swap (weak_ptr< _Tp > &__a, weak_ptr< _Tp > &__b) noexcept
๐ง to_array ๐ง
template<typename _Tp , size_t _Nm> constexpr array< remove_cv_t< _Tp >, _Nm > to_array (_Tp(&__a)[_Nm]) noexcept(is_nothrow_constructible< remove_cv_t< _Tp >, _Tp & >::value)
Create a std::array from an array.
it's constexpr, it takes a C array by reference (_Tp(&__a)[_Nm] โ note the array reference syntax, we love to see it), and its noexcept hinges on is_nothrow_constructible< remove_cv_t< _Tp >, _Tp & >::value. ๐
๐ the any_cast collective ๐
five overloads, and every single one of them is documented with the exact same one-liner โ I'm giving it to you once here because it's the literal same sentence five times over:
template<typename _ValueType > _ValueType any_cast (any &__any)
template<typename _ValueType , typename enable_if<!is_move_constructible< _ValueType >::value||is_lvalue_reference< _ValueType >::value, bool >::type = true> _ValueType any_cast (any &&__any)
template<typename _ValueType , typename enable_if< is_move_constructible< _ValueType >::value &&!is_lvalue_reference< _ValueType >::value, bool >::type = false> _ValueType any_cast (any &&__any)
template<typename _ValueType > const _ValueType * any_cast (const any *__any) noexcept
template<typename _ValueType > _ValueType * any_cast (any *__any) noexcept
Access the contained object.
yep โ all five, same blurb, no extra lore ๐
okay so the tea here: the two any &&__any overloads are SFINAE twins. one has enable_if<!is_move_constructible< _ValueType >::value||is_lvalue_reference< _ValueType >::value, bool >::type = true and the other has enable_if< is_move_constructible< _ValueType >::value &&!is_lvalue_reference< _ValueType >::value, bool >::type = false โ literally opposite conditions, defaulted to true and false respectively. and then the two pointer-taking ones are both noexcept, one returning const _ValueType * and the other _ValueType *. frosted tips energy, fr fr ๐
and that's where this chapter of the synopsis list lands โ more coming, don't go anywhere ๐
โจ Variables โจ
okay bestie, we're in the variable-template wing of the exhibit now ๐ this whole section is one giant flex of _v suffixes and using aliases, so buckle up. i'm listing them in exactly the order the page gives them, no skipping, no "lol you get the idea" โ every single one is here ๐
template<typename _Yp , typename _Tp > constexpr bool __sp_compatible_vtemplate<typename _Tp , typename _Yp > constexpr bool __sp_is_constructible_vconstexpr in_place_t in_placeโ the tag for in-place construction ๐ท๏ธ (yes, the vibe is "build it right here, don't move it")template<typename _Tp > constexpr bool is_bind_expression_vโ literally the variable template forstd::is_bind_expression๐ซถtemplate<typename _Tp > constexpr bool is_error_code_enum_vtemplate<typename _Tp > constexpr bool is_error_condition_enum_vtemplate<typename _Tp > constexpr int is_placeholder_vโ the variable template forstd::is_placeholder, and note it's anint, not abool, which is kind of iconic of it nglconstexpr nullopt_t nulloptโ the tag to disengage optional objects ๐ซฅ that's it, that's the whole jobtemplate<typename _R1 , typename _R2 > constexpr bool ratio_equal_vtemplate<typename _R1 , typename _R2 > constexpr bool ratio_greater_equal_vtemplate<typename _R1 , typename _R2 > constexpr bool ratio_greater_vtemplate<typename _R1 , typename _R2 > constexpr bool ratio_less_equal_vtemplate<typename _R1 , typename _R2 > constexpr bool ratio_less_vtemplate<typename _R1 , typename _R2 > constexpr bool ratio_not_equal_v
that whole ratio family is giving "we compare numbers at compile time and we're not sorry" โ๏ธ
template<typename _Tp > constexpr size_t tuple_size_v
and then ๐ the motherlode. the page just drops the entire classic <type_traits> constexpr bool run on us, uninterrupted, no commentary, no water. i'm giving it its own little shrine so you can see every line exactly as it appears:
template<typename _Tp > constexpr bool is_void_v
template<typename _Tp > constexpr bool is_null_pointer_v
template<typename _Tp > constexpr bool is_integral_v
template<typename _Tp > constexpr bool is_floating_point_v
template<typename _Tp > constexpr bool is_array_v
template<typename _Tp > constexpr bool is_pointer_v
template<typename _Tp > constexpr bool is_lvalue_reference_v
template<typename _Tp > constexpr bool is_rvalue_reference_v
template<typename _Tp > constexpr bool is_member_object_pointer_v
template<typename _Tp > constexpr bool is_member_function_pointer_v
template<typename _Tp > constexpr bool is_enum_v
template<typename _Tp > constexpr bool is_union_v
template<typename _Tp > constexpr bool is_class_v
template<typename _Tp > constexpr bool is_function_v
template<typename _Tp > constexpr bool is_reference_v
template<typename _Tp > constexpr bool is_arithmetic_v
template<typename _Tp > constexpr bool is_fundamental_v
template<typename _Tp > constexpr bool is_object_v
template<typename _Tp > constexpr bool is_scalar_v
template<typename _Tp > constexpr bool is_compound_v
template<typename _Tp > constexpr bool is_member_pointer_v
template<typename _Tp > constexpr bool is_const_v
template<typename _Tp > constexpr bool is_volatile_v
template<typename _Tp > constexpr bool is_trivial_v
template<typename _Tp > constexpr bool is_trivially_copyable_v
template<typename _Tp > constexpr bool is_standard_layout_v
template<typename _Tp > constexpr bool is_pod_v
template<typename _Tp > constexpr bool is_literal_type_v
template<typename _Tp > constexpr bool is_empty_v
template<typename _Tp > constexpr bool is_polymorphic_v
template<typename _Tp > constexpr bool is_abstract_v
template<typename _Tp > constexpr bool is_final_v
template<typename _Tp > constexpr bool is_signed_v
template<typename _Tp > constexpr bool is_unsigned_v
template<typename _Tp , typename... _Args> constexpr bool is_constructible_v
template<typename _Tp > constexpr bool is_default_constructible_v
template<typename _Tp > constexpr bool is_copy_constructible_v
template<typename _Tp > constexpr bool is_move_constructible_v
template<typename _Tp , typename _Up > constexpr bool is_assignable_v
template<typename _Tp > constexpr bool is_copy_assignable_v
template<typename _Tp > constexpr bool is_move_assignable_v
template<typename _Tp > constexpr bool is_destructible_v
template<typename _Tp , typename... _Args> constexpr bool is_trivially_constructible_v
template<typename _Tp > constexpr bool is_trivially_default_constructible_v
template<typename _Tp > constexpr bool is_trivially_copy_constructible_v
template<typename _Tp > constexpr bool is_trivially_move_constructible_v
template<typename _Tp , typename _Up > constexpr bool is_trivially_assignable_v
template<typename _Tp > constexpr bool is_trivially_copy_assignable_v
template<typename _Tp > constexpr bool is_trivially_move_assignable_v
template<typename _Tp > constexpr bool is_trivially_destructible_v
template<typename _Tp , typename... _Args> constexpr bool is_nothrow_constructible_v
template<typename _Tp > constexpr bool is_nothrow_default_constructible_v
template<typename _Tp > constexpr bool is_nothrow_copy_constructible_v
template<typename _Tp > constexpr bool is_nothrow_move_constructible_v
template<typename _Tp , typename _Up > constexpr bool is_nothrow_assignable_v
template<typename _Tp > constexpr bool is_nothrow_copy_assignable_v
template<typename _Tp > constexpr bool is_nothrow_move_assignable_v
template<typename _Tp > constexpr bool is_nothrow_destructible_v
template<typename _Tp > constexpr bool has_virtual_destructor_v
template<typename _Tp > constexpr size_t alignment_of_v
template<typename _Tp > constexpr size_t rank_v
template<typename _Tp , unsigned _Idx = 0> constexpr size_t extent_v
template<typename _Tp , typename _Up > constexpr bool is_same_v
template<typename _Tp > constexpr bool is_same_v< _Tp, _Tp >
template<typename _Base , typename _Derived > constexpr bool is_base_of_v
template<typename _From , typename _To > constexpr bool is_convertible_v
notice alignment_of_v, rank_v and extent_v are the size_t girlies in a sea of bool โ and extent_v even brought a default argument unsigned _Idx = 0 to the party ๐. also is_same_v< _Tp, _Tp > is a separate specialisation line, don't let it sneak past you ๐
then the logic trio, back on their constexpr bool grind:
template<typename... _Bn> constexpr bool conjunction_vtemplate<typename... _Bn> constexpr bool disjunction_vtemplate<typename _Pp > constexpr bool negation_vโ and yeah, this one takes a single_Pp, not a pack. it's a solo act ๐
๐ฆ the detection-idiom section (a.k.a. the metafunction girlies) ๐ฆ
every single one of these carries the exact same blurb on the page โ "A metafunction that always yields void, used for detecting valid types." โ so yes, i'm saying it every time, because the page said it every time. consistency is a lifestyle โจ
template<typename... > using void_t = voidโ a metafunction that always yieldsvoid, used for detecting valid types ๐ซงtemplate<typename _Default , template< typename... > class _Op, typename... _Args> using detected_or = std::__detected_or< _Default, _Op, _Args... >โ a metafunction that always yieldsvoid, used for detecting valid types โจtemplate<typename _Default , template< typename... > class _Op, typename... _Args> using detected_or_t = typename detected_or< _Default, _Op, _Args... >::typeโ a metafunction that always yieldsvoid, used for detecting valid types ๐ซ (this one's the::typeremix of the previous one)template<template< typename... > class _Op, typename... _Args> using detected_t = detected_or_t< nonesuch, _Op, _Args... >โ a metafunction that always yieldsvoid, used for detecting valid types ๐ (and it's servingnonesuchrealness)template<template< typename... > class _Op, typename... _Args> using is_detected = typename detected_or< void, _Op, _Args... >::__is_detectedโ a metafunction that always yieldsvoid, used for detecting valid types ๐template<typename _Expected , template< typename... > class _Op, typename... _Args> using is_detected_exact = is_same< _Expected, detected_t< _Op, _Args... > >โ a metafunction that always yieldsvoid, used for detecting valid types โญtemplate<typename _To , template< typename... > class _Op, typename... _Args> using is_detected_convertible = is_convertible< detected_t< _Op, _Args... >, _To >โ a metafunction that always yieldsvoid, used for detecting valid types ๐ฆtemplate<template< typename... > class _Op, typename... _Args> constexpr bool is_detected_vโ a metafunction that always yieldsvoid, used for detecting valid types ๐template<typename _Expected , template< typename... > class _Op, typename... _Args> constexpr bool is_detected_exact_vโ a metafunction that always yieldsvoid, used for detecting valid types ๐ธtemplate<typename _To , template< typename... > class _Op, typename... _Args> constexpr bool is_detected_convertible_vโ a metafunction that always yieldsvoid, used for detecting valid types ๐
๐ซ Detailed Description ๐ซ
so what actually is this namespace, bestie? the page keeps it short and sweet:
Namespace for features defined in ISO Technical Specifications.
that's the whole thing. no cap, no filler, just "this is where the ISO TS features hang out" ๐โจ
๐ FUNCTION DOCUMENTATION ๐
okay so this is where the actual callable stuff lives, bestie โ the function docs, no cap. Every signature is kept exactly as-is, because we do not mess with template parameters in this house. ๐ซถ
๐งฎ std::experimental::fundamentals_v2::gcd
literally the greatest common divisor, bestie. itโs tagged [constexpr] and [noexcept], so yes, itโs giving efficient icon behavior. ๐ซ
template<typename _Mn , typename _Nn > constexpr common_type_t< _Mn, _Nn >
std::experimental::fundamentals_v2::gcd (_Mn __m, _Nn __n) [constexpr],
[noexcept]
The docs say References gcd(). and Referenced by gcd(). โ self-referential documentation moment, and honestly? we respect it. ๐
๐๏ธ std::experimental::fundamentals_v2::get_deleter
this one is [inline] and [noexcept], and its entire description is just this number. no extra lore. ๐
template<typename _Del , typename _Tp > _Del *
std::experimental::fundamentals_v2::get_deleter (const shared_ptr< _Tp >
& __p) [inline], [noexcept]
The description is literally C++14 20.8.2.2.10. โ periodt.
๐ข std::experimental::fundamentals_v2::lcm
the least common multiple, obviously. this one is [constexpr] and not [noexcept], so donโt go mixing up the tags, bestie. ๐ธ
template<typename _Mn , typename _Nn > constexpr common_type_t< _Mn, _Nn >
std::experimental::fundamentals_v2::lcm (_Mn __m, _Nn __n) [constexpr]
The docs hit us with References lcm(). and Referenced by lcm(). โ again with the self-reference, and we love the consistency. โจ
๐ std::experimental::fundamentals_v1::make_boyer_moore_horspool_searcher
this is the generator function for boyer_moore_horspool_searcher, and itโs [inline]. the template situation is very much giving โtrust me, the defaults are cozy.โ ๐
template<typename _RAIter , typename _Hash = std::hash<typename std::iterator_traits<_RAIter>::value_type>, typename _BinaryPredicate = equal_to<>> boyer_moore_horspool_searcher< _RAIter, _Hash, _BinaryPredicate >
std::experimental::fundamentals_v1::make_boyer_moore_horspool_searcher (_RAIter __pat_first, _RAIter __pat_last, _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) [inline]
The reference tea is: References make_boyer_moore_horspool_searcher(), and std::move(). and Referenced by make_boyer_moore_horspool_searcher(). โ itโs giving main character energy in its own docs. ๐
๐ std::experimental::fundamentals_v1::make_boyer_moore_searcher
the generator function for boyer_moore_searcher, also [inline]. same template energy, slightly different searcher name โ do not mix them up, iykyk. ๐ซถ
template<typename _RAIter , typename _Hash = std::hash<typename std::iterator_traits<_RAIter>::value_type>, typename _BinaryPredicate = equal_to<>> boyer_moore_searcher< _RAIter, _Hash, _BinaryPredicate >
std::experimental::fundamentals_v1::make_boyer_moore_searcher (_RAIter __pat_first, _RAIter __pat_last, _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) [inline]
Reference check, no cap: References make_boyer_moore_searcher(), and std::move(). and Referenced by make_boyer_moore_searcher(). โ self-love, slay. ๐
๐งต std::experimental::fundamentals_v1::make_default_searcher
this is the generator function for default_searcher, and itโs [inline]. itโs lowkey the calm, classic one of the searcher generator squad. ๐ผ
template<typename _ForwardIterator , typename _BinaryPredicate = std::equal_to<>> default_searcher< _ForwardIterator, _BinaryPredicate >
std::experimental::fundamentals_v1::make_default_searcher (_ForwardIterator __pat_first, _ForwardIterator __pat_last, _BinaryPredicate __pred = _BinaryPredicate()) [inline]
The docs say References make_default_searcher(). and Referenced by make_default_searcher(). โ again, self-referential, and honestly? iconic. ๐
๐ std::experimental::fundamentals_v2::make_ostream_joiner
this one is the object generator for ostream_joiner, and itโs [inline]. itโs giving โi make the stream join things, youโre welcome.โ โจ
template<typename _CharT , typename _Traits , typename _DelimT > ostream_joiner< decay_t< _DelimT >, _CharT, _Traits >
std::experimental::fundamentals_v2::make_ostream_joiner (basic_ostream< _CharT, _Traits > & __os, _DelimT && __delimiter) [inline]
Reference moment: References make_ostream_joiner(). and Referenced by make_ostream_joiner(). โ no notes, just vibes. ๐ฆ
๐ฒ std::experimental::fundamentals_v2::sample
this is the one that will take a random sample from a population โ yes, thatโs the whole description, and it ate. ๐ฅ
template<typename _PopulationIterator , typename _SampleIterator , typename _Distance , typename _UniformRandomNumberGenerator > _SampleIterator
std::experimental::fundamentals_v2::sample (_PopulationIterator __first, _PopulationIterator __last, _SampleIterator __out, _Distance __n, _UniformRandomNumberGenerator && __g)
no reference lines here, just pure sampling business. we love a clean exit. ๐
๐งธ VARIABLE DOCUMENTATION ๐งธ
these are the variable-template girlies, bestie โ short, sweet, and very much [constexpr]. ๐
๐ช std::experimental::fundamentals_v1::is_bind_expression_v
a variable template for std::is_bind_expression, and itโs [constexpr]. simple, useful, slay.
template<typename _Tp > constexpr bool
std::experimental::fundamentals_v1::is_bind_expression_v [constexpr]
๐ช std::experimental::fundamentals_v1::is_placeholder_v
a variable template for std::is_placeholder, also [constexpr], also doing exactly what it says on the tin. ๐
template<typename _Tp > constexpr int
std::experimental::fundamentals_v1::is_placeholder_v [constexpr]
๐ธ AUTHOR ๐ธ
Generated automatically by Doxygen for libstdc++ from the source code. periodt. ๐
mwah ๐ โ source/version libstdc++, page std::experimental(3cxx), and thatโs the cute little footer sign-off, bestie. ๐ซถโจ
๐ฆ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms