std::experimental::any(3)

πŸ’– NAME πŸ’–

std::experimental::any β€” a type-safe container of any type 🫢

(this is the libstdc++ page from the Library Functions Manual, bestie, so you're in exactly the right place ✨)


πŸŽ€ SYNOPSIS πŸŽ€

#include <any>

πŸ‘‘ Public Member Functions

  • any () noexcept β€” Default constructor, creates an empty object.
  • 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) β€” Construct with a copy of __value as the contained object.
  • 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) β€” Construct with a copy of __value as the contained object.
  • any (any &&__other) noexcept β€” Move constructor, transfer the state from __other.
  • any (const any &__other) β€” Copy constructor, copies the state of __other.
  • ~any () β€” Destructor, calls clear().
  • void clear () noexcept β€” If not empty, destroy the contained object.
  • bool empty () const noexcept β€” Reports whether there is a contained object or not.
  • template<typename _ValueType> enable_if_t<!is_same< any, decay_t< _ValueType > >::value, any & > operator= (_ValueType &&__rhs) β€” Store a copy of __rhs as the contained object.
  • any & operator= (any &&__rhs) noexcept β€” Move assignment operator.
  • any & operator= (const any &__rhs) β€” Copy the state of another object.
  • void swap (any &__rhs) noexcept β€” Exchange 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 ()

🌈 Friends

  • template<typename _Tp> enable_if_t< is_object< _Tp >::value, void * > __any_caster (const any *__any)

πŸ’… Detailed Description πŸ’…

A type-safe container of any type.

An any object's state is either empty or it stores a contained object of CopyConstructible type. ✨


πŸ“ Constructor & Destructor Documentation πŸ“

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

Default constructor, creates an empty object.

Referenced by any(), any(), operator=(), operator=(), operator=(), and swap().


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

Copy constructor, copies the state of __other.

References any(), and empty().


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

Move constructor, transfer the state from __other.

Postcondition __other.empty() (this postcondition is a GNU extension)

References any().


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]

Construct with a copy of __value as the contained object.

References std::forward().


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]

Construct with a copy of __value as the contained object.


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

Destructor, calls clear().

References clear().


πŸ’œ Member Function Documentation πŸ’œ

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

If not empty, destroy the contained object.

References empty().

Referenced by ~any(), and operator=().


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

Reports whether there is a contained object or not.

Referenced by any(), clear(), swap(), and type().


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

Store a copy of __rhs as the contained object.

References any(), and std::forward().


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

Move assignment operator.

Postcondition __rhs.empty() (not guaranteed for other implementations)

References any(), and clear().


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

Copy the state of another object.

References any().


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

Exchange state with another object.

References any(), and 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 that's the whole vibe check bestie, every single member function accounted for, no cap πŸ‘‘ this whole page lives under the libstdc++ banner in the Library Functions Manual β€” go forth and cast responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ 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.0.1-0.10.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
  • 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