STD::EXPERIMENTAL::PROPAGATE_CONST(3)
π NAME π
std::experimental::propagate_const< _Tp > β a const-propagating wrapper, bestie. That's the whole thing, that's the vibe β¨
It's a Library Functions Manual page and it lives in libstdc++, so like, that's the fam we're hanging with π«Ά
π SYNOPSIS π
#include <propagate_const>
π Public Types π
using element_typeβ the one and only public type alias this class declares. That's the line. Short, sweet, iconic π
π¦ Public Member Functions π¦
okay so here's the full roster, no skips, every single one π
- converting constructor, non-convertible flavour β only shows up when the constraints pass:
_Tphas to be constructible from_Up &&,_Up &&must not be convertible to_Tp, and the decayed_Upmust not itself be apropagate_const. That trailingboolisfalsehere.
template<typename _Up, typename enable_if< __and_< is_constructible< _Tp, _Up && >, __not_< is_convertible< _Up &&, _Tp > >, __not_< __is_propagate_const< typename decay< _Up >::type > > >::value, bool >::type = false> constexpr propagate_const (_Up &&__u)
- converting constructor, convertible flavour β same deal but the other way:
_Tpconstructible from_Up &&,_Up &&is convertible to_Tp, and the decayed_Upstill isn't apropagate_const. Trailingbooldefaults totruethis time.
template<typename _Up, typename enable_if< __and_< is_constructible< _Tp, _Up && >, is_convertible< _Up &&, _Tp >, __not_< __is_propagate_const< typename decay< _Up >::type > > >::value, bool >::type = true> constexpr propagate_const (_Up &&__u)
- copy constructor β
=delete. Not happening. No copying, periodt π«
propagate_const (const propagate_const &__p)=delete
- move constructor β
=default, so it's the compiler's own, untouched π
constexpr propagate_const (propagate_const &&__p)=default
- converting move constructor, non-convertible flavour β pulls from a
propagate_const< _Up > &&when_Tpis constructible from_Up &&and_Up &&is not convertible to_Tp. Trailingboolisfalse.
template<typename _Up, typename enable_if< __and_< is_constructible< _Tp, _Up && >, __not_< is_convertible< _Up &&, _Tp > > >::value, bool >::type = false> constexpr propagate_const (propagate_const< _Up > &&__pu)
- converting move constructor, convertible flavour β same but
_Up &&is convertible to_Tp. Trailingbooldefaults totrue.
template<typename _Up, typename enable_if< __and_< is_constructible< _Tp, _Up && >, is_convertible< _Up &&, _Tp > >::value, bool >::type = true> constexpr propagate_const (propagate_const< _Up > &&__pu)
get(non-const) β hands you back anelement_type *.
constexpr element_type * get ()
get(const) β the const flavour, hands you back aconst element_type *.
constexpr const element_type * get () const
operator boolβ the truthiness check,const,constexprβ¨
constexpr operator bool () const
operator*β deref, non-const, gives you anelement_type &.
constexpr element_type & operator* ()
operator*(const) β deref, const, gives you aconst element_type &.
constexpr const element_type & operator* () const
operator->β arrow, non-const, gives you anelement_type *.
constexpr element_type * operator-> ()
operator->(const) β arrow, const, gives you aconst element_type *.
constexpr const element_type * operator-> () const
- assignment from
_Up &&β only enabled when_Up &&is convertible to_Tpand the decayed_Upis not apropagate_const. Returnspropagate_const &.
template<typename _Up, typename = typename
enable_if<__and_<is_convertible<_Up&&, _Tp>,
__not_<__is_propagate_const<
typename decay<_Up>::type>>
>::value>::type> constexpr propagate_const & operator= (_Up &&__u)
- copy assignment β
=deleteagain. Still no copying, bestie π
propagate_const & operator= (const propagate_const &__p)=delete
- move assignment β
=default, compiler's own π
constexpr propagate_const & operator= (propagate_const &&__p)=default
- move assignment from
propagate_const< _Up > &&β enabled when_Up &&is convertible to_Tp. Returnspropagate_const &.
template<typename _Up, typename = typename
enable_if<is_convertible<_Up&&, _Tp>::value>::type> constexpr
propagate_const & operator= (propagate_const< _Up > &&__pu)
swapβ swaps with anotherpropagate_const &. It'snoexceptexactly when__is_nothrow_swappable< _Tp >::valueis true, so the noexcept-ness rides entirely on_Tpπ¦
constexpr void swap (propagate_const &__pt)
noexcept(__is_nothrow_swappable< _Tp >::value)
πΈ Friends πΈ
the little helper besties that get to peek inside π«Ά
get_underlying(const) β takes aconst propagate_const< _Up > &and gives you back aconst _Up &. It'snoexcept, no drama.
template<typename _Up> constexpr const _Up & get_underlying (const
propagate_const< _Up > &__pt) noexcept
get_underlying(non-const) β takes apropagate_const< _Up > &and gives you back a_Up &. Alsonoexcept.
template<typename _Up> constexpr _Up & get_underlying (propagate_const<
_Up > &__pt) noexcept
π Detailed Description π
here's the whole class, laid out in its full templated glory:
template<typename _Tp>
class std::experimental::propagate_const< _Tp >
"Const-propagating wrapper."
That's the description. It's short. It's giving minimalism. We respect it π
β Author β
Generated automatically by Doxygen for libstdc++ from the source code.
and that's a wrap, bestie π this whole page came out of libstdc++, auto-generated by Doxygen straight from the source code, and it's the std::experimental::propagate_const< _Tp >(3) page. go forth and propagate those consts πβ¨π¦
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms