Block-Structured AMR Software Framework
amrex::Any Class Reference

#include <AMReX_Any.H>

Classes

struct  innards
 
struct  innards_base
 

Public Member Functions

 Any ()=default
 
 ~Any ()=default
 
 Any (Any const &rhs)=delete
 
Anyoperator= (Any const &rhs)=delete
 
 Any (Any &&rhs)=default
 
Anyoperator= (Any &&rhs)=default
 
template<typename MF , std::enable_if_t<!std::is_same_v< Any, std::decay_t< MF >>, int > = 0>
 Any (MF &&mf)
 Constructs by moving the given object. More...
 
template<typename MF , std::enable_if_t<!std::is_same_v< Any, std::decay_t< MF >>, int > = 0>
Anyoperator= (MF &&mf)
 Assigns by moving the given object. More...
 
const std::type_info & Type () const
 Returns the contained type. More...
 
template<typename MF >
MF & get ()
 Returns a reference to the contained object. More...
 
template<typename MF >
MF const & get () const
 Returns a const reference to the contained object. More...
 
template<typename MF >
bool is () const
 
bool hasValue () const
 

Private Attributes

std::unique_ptr< innards_basem_ptr
 

Detailed Description

This class is similar to std::any. However, amrex::Any can store move-only types (e.g., amrex::MultiFab), whereas std::any is for copy constructible types only. An object of this class is non-copyable.

Constructor & Destructor Documentation

◆ Any() [1/4]

amrex::Any::Any ( )
default

◆ ~Any()

amrex::Any::~Any ( )
default

◆ Any() [2/4]

amrex::Any::Any ( Any const &  rhs)
delete

◆ Any() [3/4]

amrex::Any::Any ( Any &&  rhs)
default

◆ Any() [4/4]

template<typename MF , std::enable_if_t<!std::is_same_v< Any, std::decay_t< MF >>, int > = 0>
amrex::Any::Any ( MF &&  mf)
inline

Constructs by moving the given object.

Member Function Documentation

◆ get() [1/2]

template<typename MF >
MF& amrex::Any::get ( )
inline

Returns a reference to the contained object.

◆ get() [2/2]

template<typename MF >
MF const& amrex::Any::get ( ) const
inline

Returns a const reference to the contained object.

◆ hasValue()

bool amrex::Any::hasValue ( ) const
inline

◆ is()

template<typename MF >
bool amrex::Any::is ( ) const
inline

◆ operator=() [1/3]

Any& amrex::Any::operator= ( Any &&  rhs)
default

◆ operator=() [2/3]

Any& amrex::Any::operator= ( Any const &  rhs)
delete

◆ operator=() [3/3]

template<typename MF , std::enable_if_t<!std::is_same_v< Any, std::decay_t< MF >>, int > = 0>
Any& amrex::Any::operator= ( MF &&  mf)
inline

Assigns by moving the given object.

◆ Type()

const std::type_info& amrex::Any::Type ( ) const
inline

Returns the contained type.

Member Data Documentation

◆ m_ptr

std::unique_ptr<innards_base> amrex::Any::m_ptr
private

The documentation for this class was generated from the following file: