3 #ifndef DUNE_FUNCTIONS_COMMON_TYPEERASURE_HH 4 #define DUNE_FUNCTIONS_COMMON_TYPEERASURE_HH 8 #include <dune/common/typeutilities.hh> 33 template<
class Interface>
39 virtual const std::type_info&
target_type()
const = 0;
60 template<
class Interface,
class T>
65 template<
class TT, disableCopyMove<TypeErasureWrapperBase, TT> = 0>
67 wrapped_(
std::forward<TT>(t))
112 template<
class Interface,
template<
class>
class Implementation,
class T>
114 public Implementation<TypeErasureWrapperBase<Interface, T> >
119 template<
class TT, disableCopyMove<TypeErasureWrapperImplementation, T> = 0>
163 template<
class Interface,
template<
class>
class Implementation,
size_t bufferSize = 56>
169 template<
class T, disableCopyMove<TypeErasureBase, T> = 0 >
171 wrapped_(Imp::TypeErasureWrapperImplementation<Interface, Implementation, typename
std::decay<T>::type>(
std::forward<T>(t)))
180 return wrapped_.get();
186 return wrapped_.get();
192 return wrapped_.get().target_type();
204 #endif // DUNE_FUNCTIONS_COMMON_TYPEERASURE_HH TypeErasureWrapperBase(TT &&t)
Definition: typeerasure.hh:66
Base class with polymorphic type boiler plate code.
Definition: interfaces.hh:24
Implementation of the internal wrapper interface.
Definition: typeerasure.hh:113
TypeErasureBase(T &&t)
Construct wrapper from object.
Definition: typeerasure.hh:170
Wrapped wrapped_
Definition: typeerasure.hh:84
Definition: polynomial.hh:7
Base implementation of the internal wrapper interface.
Definition: typeerasure.hh:61
virtual TypeErasureWrapperImplementation * move(void *buffer)
Implementation of PolymorphicType::move(void* buffer)
Definition: typeerasure.hh:137
virtual const std::type_info & target_type() const =0
virtual TypeErasureWrapperImplementation * clone(void *buffer) const
Implementation of PolymorphicType::clone(void* buffer)
Definition: typeerasure.hh:131
virtual const std::type_info & target_type() const
Get type of stored object.
Definition: typeerasure.hh:190
TypeErasureWrapperImplementation(TT &&t)
Construct wrapper from object.
Definition: typeerasure.hh:120
PolymorphicSmallObject< Imp::TypeErasureWrapperInterface< Interface >, bufferSize > wrapped_
Definition: typeerasure.hh:196
Interface & asInterface()
Get mutable reference to wrapped object.
Definition: typeerasure.hh:178
Base class for type-erased interface wrapper.
Definition: typeerasure.hh:164
const Interface & asInterface() const
Get reference to wrapped object.
Definition: typeerasure.hh:184
The internal wrapper interface for type erasure.
Definition: typeerasure.hh:34
A wrapper providing small object optimization with polymorphic types.
Definition: polymorphicsmallobject.hh:38
virtual TypeErasureWrapperImplementation * clone() const
Implementation of PolymorphicType::clone()
Definition: typeerasure.hh:125
virtual const std::type_info & target_type() const
Get type of stored object.
Definition: typeerasure.hh:143
T Wrapped
Definition: typeerasure.hh:83