std::experimental::any(3cxx)

NAME πŸ’–

Manual page: std::experimental::any(3cxx) β€” okay bestie, that’s the manual name folded in right here. std::experimental::any is a type-safe container of any type. That’s the whole name vibe ✨.

SYNOPSIS πŸ¦‹

Include it like this, no cap:

#include <any>

Public Member Functions πŸ’…

  • any () noexcept β€” default constructor: creates an empty object.
  • Templated constructor #1 β€” the is_constructible< _Tp, _ValueType && >::value flavor. Exact signature:
template<typename _ValueType , typename _Tp  = _Decay<_ValueType>,
    typename _Mgr  = _Manager<_Tp>, typename enable_if<
    is_constructible< _Tp, _ValueType && >::value, bool >::type  = true>
    any (_ValueType &&__value)

Constructs the contained object from a copy of __value πŸ’–.

  • Templated constructor #2 β€” the !is_constructible< _Tp, _ValueType && >::value flavor. Exact signature:
template<typename _ValueType , typename _Tp  = _Decay<_ValueType>,
    typename _Mgr  = _Manager<_Tp>, typename
    enable_if<!is_constructible< _Tp, _ValueType && >::value, bool
    >::type  = false> any (_ValueType &&__value)

Constructs the contained object from a copy of __value too, just with the opposite enable-if situation 🫢.

  • any (any &&__other) noexcept β€” move constructor; transfers the state from __other.
  • any (const any &__other) β€” copy constructor; copies the state of __other.
  • ~any () β€” destructor; calls clear().
  • void clear () noexcept β€” if it’s not empty, destroy the contained object.
  • bool empty () const noexcept β€” reports whether there is a contained object or not.
  • Templated operator= β€” stores a copy of __rhs as the contained object. Exact signature:
template<typename _ValueType > enable_if_t<!is_same< any, decay_t<
    _ValueType > >::value, any & > operator= (_ValueType &&__rhs)
  • any & operator= (any &&__rhs) noexcept β€” move assignment operator.
  • any & operator= (const any &__rhs) β€” copies the state of another object.
  • void swap (any &__rhs) noexcept β€” exchanges state with another object.
  • const type_info & type () const noexcept β€” the typeid of the contained object, or typeid(void) if empty.

Static Public Member Functions 🌸

  • template<typename _Tp > static constexpr bool __is_valid_cast () β€” that’s the static member function exactly as listed, bestie.

Friends πŸŽ€

  • __any_caster β€” exact declaration:
template<typename _Tp > enable_if_t< is_object< _Tp >::value, void * >
    __any_caster (const any *__any)

Detailed Description πŸ¦‹

Okay so std::experimental::any is a type-safe container of any type ✨.

An any object’s state is either empty, or it stores a contained object of CopyConstructible type. That’s the vibe check, periodt πŸ’….

Constructor & Destructor Documentation πŸ’–

std::experimental::any::any () [inline], [noexcept]

Default constructor, creates an empty object. Referenced by operator=(), and operator=().

std::experimental::any::any (const any & __other) [inline]

Copy constructor, copies the state of __other. References: empty().

std::experimental::any::any (any && __other) [inline], [noexcept]

Move constructor, transfers the state from __other.

Postcondition: __other.empty() (this postcondition is a GNU extension) πŸ‘‘

std::experimental::any::any (_ValueType && __value) β€” the is_constructible< _Tp, _ValueType && >::value version [inline]

Exact signature:

template<typename _ValueType , typename _Tp  = _Decay<_ValueType>, typename
    _Mgr  = _Manager<_Tp>, typename enable_if< is_constructible< _Tp,
    _ValueType && >::value, bool >::type  = true>
    std::experimental::any::any (_ValueType && __value) [inline]

Constructs the contained object from a copy of __value πŸ’–.

std::experimental::any::any (_ValueType && __value) β€” the !is_constructible< _Tp, _ValueType && >::value version [inline]

Exact signature:

template<typename _ValueType , typename _Tp  = _Decay<_ValueType>, typename
    _Mgr  = _Manager<_Tp>, typename enable_if<!is_constructible< _Tp,
    _ValueType && >::value, bool >::type  = false>
    std::experimental::any::any (_ValueType && __value) [inline]

Constructs the contained object from a copy of __value, with the opposite enable-if setup 🫢.

std::experimental::any::~any () [inline]

Destructor, calls clear(). References: clear().

Member Function Documentation πŸ’…

void std::experimental::any::clear () [inline], [noexcept]

If it’s not empty, destroy the contained object. References: empty(). Referenced by ~any(), and operator=().

bool std::experimental::any::empty () const [inline], [noexcept]

Reports whether there is a contained object or not. Referenced by any(), clear(), swap(), and type().

Templated std::experimental::any::operator= β€” the _ValueType && __rhs version [inline]

Exact signature:

template<typename _ValueType > enable_if_t<!is_same< any, decay_t<
    _ValueType > >::value, any & > std::experimental::any::operator=
    (_ValueType && __rhs) [inline]

Stores a copy of __rhs as the contained object. References: any().

any & std::experimental::any::operator= (any && __rhs) [inline], [noexcept]

Move assignment operator.

Postcondition: __rhs.empty() (not guaranteed for other implementations) πŸ’€

References: clear().

any & std::experimental::any::operator= (const any & __rhs) [inline]

Copies the state of another object. References: any().

void std::experimental::any::swap (any & __rhs) [inline], [noexcept]

Exchanges state with another object. References: empty().

const type_info & std::experimental::any::type () const [inline], [noexcept]

The typeid of the contained object, or typeid(void) if empty. References: empty().

Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code.


Okay bestie, that’s the whole page πŸ’– source/version: libstdc++; page id: std::experimental::any(3cxx); date: the original footer didn’t print one, so no timestamp to hand you β€” lowkey tragic πŸ’€. Bye 🫢

πŸ“¦ where this page comes from