A copyable type wrapper that provides copy/move assignment operations for types that are only copy/move constructible.
More...
|
| template<class T = Type, std::enable_if_t< std::is_default_constructible_v< T >, int > = 0> |
| constexpr | CopyableOptional () noexcept(std::is_nothrow_default_constructible_v< T >) |
| | Implementation of a default constructor, if the Type is itself default constructible. The internal optional contains a value-initialized Type. More...
|
| |
| template<class T = Type, disableCopyMove< CopyableOptional, T > = 0, std::enable_if_t< std::is_constructible_v< Type, T &&>, int > = 0, std::enable_if_t< std::is_convertible_v< T &&, Type >, int > = 0> |
| constexpr | CopyableOptional (T &&value) noexcept(std::is_nothrow_constructible_v< Type, T &&>) |
| | Construct the internal data from perfect forwarding of the passed arguments. Participates in overload resolution if T is implicitly convertible to Type. More...
|
| |
| template<class T = Type, disableCopyMove< CopyableOptional, T > = 0, std::enable_if_t< std::is_constructible_v< Type, T &&>, int > = 0, std::enable_if_t< not std::is_convertible_v< T &&, Type >, int > = 0> |
| constexpr | CopyableOptional (T &&value) noexcept(std::is_nothrow_constructible_v< Type, T &&>) |
| | Construct the internal data from perfect forwarding of the passed arguments. Participates in overload resolution if T is not implicitly convertible to Type. More...
|
| |
| template<class... Args, disableCopyMove< CopyableOptional, Args... > = 0, std::enable_if_t<(sizeof...(Args) > 1> |
| constexpr | CopyableOptional (Args &&... args) noexcept(std::is_nothrow_constructible_v< Type, Args &&... >) |
| | Construct the internal data from perfect forwarding of the passed arguments. More...
|
| |
| constexpr | CopyableOptional (const CopyableOptional &)=default |
| | Copy construct the contained value. More...
|
| |
| constexpr | CopyableOptional (CopyableOptional &&)=default |
| | Move construct the contained value. More...
|
| |
| | ~CopyableOptional ()=default |
| | Default destructor. More...
|
| |
| constexpr CopyableOptional & | operator= (const CopyableOptional &that) noexcept(std::is_nothrow_copy_assignable_v< Type >||(!std::is_copy_assignable_v< Type > &&std::is_nothrow_copy_constructible_v< Type >)) |
| | Copy assignment in terms of copy constructor. More...
|
| |
| template<class T = Type, std::enable_if_t< std::is_move_constructible_v< T >, int > = 0> |
| constexpr CopyableOptional & | operator= (CopyableOptional &&that) noexcept(std::is_nothrow_move_assignable_v< Type >||(!std::is_move_assignable_v< Type > &&std::is_nothrow_move_constructible_v< Type >)) |
| | Move assignment in terms of move constructor. More...
|
| |
| template<class T = Type, std::enable_if_t< not std::is_same_v< std::decay_t< T >, CopyableOptional >, int > = 0, std::enable_if_t<(std::is_assignable_v< Type &, T >||std::is_constructible_v< Type, T >), int > = 0> |
| constexpr CopyableOptional & | operator= (T &&value) noexcept(std::is_nothrow_assignable_v< Type &, T >||(!std::is_assignable_v< Type &, T > &&std::is_nothrow_constructible_v< Type, T >)) |
| | Perfect-forwarded assignment or construction. More...
|
| |
template<class Type>
class Dune::CopyableOptional< Type >
A copyable type wrapper that provides copy/move assignment operations for types that are only copy/move constructible.
Some types, like lambdas, LocalFiniteElementCache, Geometries,... provide a copy/move constructor but do not provide a corresponding assignment operator. Mostly, the assignment operators can be implemented in terms of the corresponding constructors. This type wrapper provides these assignment operators by internally wrapping the type into a std::optional.
- Template Parameters
-
| Type | The type to be wrapped and equipped with copy operations. |
Requirements: Type must be an object type that is copy-constructible
template<class Type >
template<class T = Type, disableCopyMove< CopyableOptional, T > = 0, std::enable_if_t< std::is_constructible_v< Type, T &&>, int > = 0, std::enable_if_t< std::is_convertible_v< T &&, Type >, int > = 0>
Construct the internal data from perfect forwarding of the passed arguments. Participates in overload resolution if T is implicitly convertible to Type.
template<class Type >
template<class T = Type, disableCopyMove< CopyableOptional, T > = 0, std::enable_if_t< std::is_constructible_v< Type, T &&>, int > = 0, std::enable_if_t< not std::is_convertible_v< T &&, Type >, int > = 0>
Construct the internal data from perfect forwarding of the passed arguments. Participates in overload resolution if T is not implicitly convertible to Type.