SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
Utility wrapper that behaves like std::optional but makes the type conform with the std::copyable concept. More...
#include <seqan3/core/detail/copyable_wrapper.hpp>
Public Member Functions | |
constexpr | copyable_wrapper ()=default |
copyable_wrapper is default constructible, iff the wrapped type is default initialisable. | |
constexpr | copyable_wrapper (copyable_wrapper &&)=default |
Defaulted. | |
constexpr | copyable_wrapper (copyable_wrapper const &)=default |
Defaulted. | |
template<typename... args_t> requires std::constructible_from<t, args_t...> | |
constexpr | copyable_wrapper (std::in_place_t, args_t... args) noexcept(std::is_nothrow_constructible_v< t, args_t... >) |
Construct from argument pack. Part of the std::optional API. | |
constexpr | copyable_wrapper (t &&other) noexcept(std::is_nothrow_move_constructible_v< t >) |
Move construct from value. | |
constexpr | copyable_wrapper (t const &other) noexcept(std::is_nothrow_copy_constructible_v< t >) |
Copy construct from value. | |
constexpr bool | has_value () const noexcept |
Return whether the wrapper contains a value. Part of the std::optional API. | |
template<typename... args_t> requires std::invocable<t, args_t...> | |
constexpr decltype(auto) | operator() (args_t... args) const noexcept(std::is_nothrow_invocable_v< t, args_t... >) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename... args_t> requires std::invocable<t, args_t...> | |
constexpr decltype(auto) | operator() (args_t... args) noexcept(std::is_nothrow_invocable_v< t, args_t... >) |
Invokes the wrapped object with passed arguments. | |
constexpr t const & | operator* () const noexcept |
Returns a reference to the wrapped object. Part of the std::optional API. | |
constexpr t & | operator* () noexcept |
Returns a reference to the wrapped object. Part of the std::optional API. | |
constexpr t const * | operator-> () const noexcept |
Returns a pointer to the wrapped object. Part of the std::optional API. | |
constexpr t * | operator-> () noexcept |
Returns a pointer to the wrapped object. Part of the std::optional API. | |
constexpr copyable_wrapper & | operator= (copyable_wrapper &&)=default |
Move assignment for copyable types is the default move assignment. | |
constexpr copyable_wrapper & | operator= (copyable_wrapper &&other) noexcept |
Move assignment for non-copyable types uses the Destroy-then-copy paradigm. | |
constexpr copyable_wrapper & | operator= (copyable_wrapper const &)=default |
Copy assignment for copyable types is the default copy assignment. | |
constexpr copyable_wrapper & | operator= (copyable_wrapper const &other) noexcept |
Copy assignment for non-copyable types uses the Destroy-then-copy paradigm. | |
constexpr | ~copyable_wrapper ()=default |
Defaulted. | |
Private Attributes | |
t | value {} |
An object of the wrapped type. | |
Utility wrapper that behaves like std::optional but makes the type conform with the std::copyable concept.
If t
is std::copyable
, the STL allows to store t
directly, i.e. no std::optional
is needed.
|
inlineconstexprnoexcept |
Invokes the wrapped object with passed arguments.
This is a SeqAn-specific extension that allows easy invocation of the wrapped object. t
needs to be callable with the passed arguments.
Constness of this function depends on the constness of the call-operator of the wrapped object.