3 #include <AMReX_Config.H>
30 template <
typename MF,
31 std::enable_if_t<!std::is_same_v<Any,std::decay_t<MF>>,
int> = 0>
33 :
m_ptr(std::make_unique<
innards<MF> >(std::forward<MF>(mf)))
37 template <
typename MF,
38 std::enable_if_t<!std::is_same_v<Any,std::decay_t<MF>>,
int> = 0>
40 m_ptr = std::make_unique<innards<MF> >(std::forward<MF>(mf));
45 [[nodiscard]]
const std::type_info&
Type ()
const {
54 template <
typename MF>
55 [[nodiscard]] MF&
get () {
64 template <
typename MF>
65 [[nodiscard]] MF
const&
get ()
const {
75 template <
typename MF>
76 [[nodiscard]]
bool is ()
const {
return Type() ==
typeid(MF); }
83 [[nodiscard]]
virtual const std::type_info&
Type ()
const = 0;
87 template <
typename MF>
96 [[nodiscard]] const std::type_info&
Type () const final {
103 std::unique_ptr<innards_base>
m_ptr;
Definition: AMReX_Any.H:17
Any(MF &&mf)
Constructs by moving the given object.
Definition: AMReX_Any.H:32
bool is() const
Definition: AMReX_Any.H:76
MF const & get() const
Returns a const reference to the contained object.
Definition: AMReX_Any.H:65
bool hasValue() const
Definition: AMReX_Any.H:78
MF & get()
Returns a reference to the contained object.
Definition: AMReX_Any.H:55
Any & operator=(Any const &rhs)=delete
const std::type_info & Type() const
Returns the contained type.
Definition: AMReX_Any.H:45
std::unique_ptr< innards_base > m_ptr
Definition: AMReX_Any.H:103
Any(Any const &rhs)=delete
Definition: AMReX_Amr.cpp:49
Definition: AMReX_Any.H:82
virtual ~innards_base()=default
virtual const std::type_info & Type() const =0
Definition: AMReX_Any.H:89
const std::type_info & Type() const final
Definition: AMReX_Any.H:96
MF m_mf
Definition: AMReX_Any.H:100
innards(MF &&mf)
Definition: AMReX_Any.H:90