Backport
any.hpp File Reference

This header provides definitions from the C++ header <any> More...

#include "detail/config.hpp"
#include "type_traits.hpp"
#include "utility.hpp"
#include <typeinfo>
#include <initializer_list>
#include <new>
#include <cassert>
+ Include dependency graph for any.hpp:

Go to the source code of this file.

Classes

class  bpstd::bad_any_cast
 
class  bpstd::any
 An object that can hold values of any type via type-erasure. More...
 

Functions

void bpstd::swap (any &lhs, any &rhs) noexcept
 Swaps the contents of lhs and rhs.
 
template<typename T >
T bpstd::any_cast (any &operand)
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T bpstd::any_cast (any &&operand)
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T bpstd::any_cast (const any &operand)
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T * bpstd::any_cast (any *operand) noexcept
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
const T * bpstd::any_cast (const any *operand) noexcept
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T bpstd::any_cast (any &operand)
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T bpstd::any_cast (any &&operand)
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T bpstd::any_cast (const any &operand)
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
T * bpstd::any_cast (any *operand) noexcept
 Attempts to cast an any back to the underlying type T. More...
 
template<typename T >
const T * bpstd::any_cast (const any *operand) noexcept
 Attempts to cast an any back to the underlying type T. More...
 

Detailed Description

This header provides definitions from the C++ header <any>

Definition in file any.hpp.

Function Documentation

◆ any_cast() [1/5]

template<typename T >
T bpstd::any_cast ( any &&  operand)

Attempts to cast an any back to the underlying type T.

Exceptions
bad_any_castif any is not exactly of type T
Template Parameters
Tthe type to cast to
Returns
the object

◆ any_cast() [2/5]

template<typename T >
T bpstd::any_cast ( any &  operand)

Attempts to cast an any back to the underlying type T.

Exceptions
bad_any_castif any is not exactly of type T
Template Parameters
Tthe type to cast to
Returns
the object

◆ any_cast() [3/5]

template<typename T >
T* bpstd::any_cast ( any *  operand)
noexcept

Attempts to cast an any back to the underlying type T.

Template Parameters
Tthe type to cast to
Returns
pointer to the object if successfull, nullptr otherwise

◆ any_cast() [4/5]

template<typename T >
T bpstd::any_cast ( const any &  operand)

Attempts to cast an any back to the underlying type T.

Exceptions
bad_any_castif any is not exactly of type T
Template Parameters
Tthe type to cast to
Returns
the object

◆ any_cast() [5/5]

template<typename T >
const T* bpstd::any_cast ( const any *  operand)
noexcept

Attempts to cast an any back to the underlying type T.

Template Parameters
Tthe type to cast to
Returns
pointer to the object if successfull, nullptr otherwise