Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::Any Class Reference

#include <AMReX_Any.H>

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.
 
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.
 
const std::type_info & Type () const
 Returns the contained type.
 
template<typename MF >
MF & get ()
 Returns a reference to the contained object.
 
template<typename MF >
MF const & get () const
 Returns a const reference to the contained object.
 
template<typename MF >
bool is () const
 
bool hasValue () const
 Returns whether the object contains a value.
 

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

Returns whether the object contains a value.

◆ is()

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

Returns whether the contained type is the same as the type used for the instantiation of this function.

◆ 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.


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