|
| constexpr | unique_handle () noexcept=default |
| | Default constructor. The value will be in an uninitialized stated and the delete action gets default constructed.
|
| |
| constexpr | ~unique_handle () noexcept |
| | Destruct. Does invoke the delete action if the value is in an initialized state.
|
| |
| SL_UNIQUE_HANDLE_FULL_CONSTEXPR | unique_handle (unique_handle &&other) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_copy_constructible_v< TDeleteAction >) |
| | Move constructor, which relocates the ownership of the value to the target and resets the source. Delete actions will be copied.
|
| |
| SL_UNIQUE_HANDLE_FULL_CONSTEXPR unique_handle & | operator= (unique_handle &&other) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_move_assignable_v< T > &&std::is_nothrow_copy_constructible_v< TDeleteAction > &&std::is_nothrow_copy_assignable_v< TDeleteAction >) |
| | Move assignment, which relocates the ownership of the value to the target and resets the source. Delete actions will be copied.
|
| |
| constexpr void | swap (unique_handle &other) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_swappable_v< T > &&std::is_nothrow_move_constructible_v< TDeleteAction > &&std::is_nothrow_swappable_v< TDeleteAction >) |
| | Swaps the target and the source in a more efficient way.
|
| |
| | unique_handle (const unique_handle &)=delete |
| | Explicitly deleted copy constructor.
|
| |
| unique_handle & | operator= (const unique_handle &)=delete |
| | Explicitly deleted copy assignment.
|
| |
| constexpr | unique_handle (nullhandle_t, const delete_action_type &deleteAction=delete_action_type()) noexcept |
| | Explicitly does not initialize the value. This overload is mainly used for convenience when returning a nullhandle.
|
| |
| SL_UNIQUE_HANDLE_FULL_CONSTEXPR unique_handle & | operator= (nullhandle_t) noexcept |
| | Explicitly resets the value and invokes the delete action if value was initialized.
|
| |
| constexpr | unique_handle (const delete_action_type &deleteAction) noexcept |
| | Constructor overload for explicitly providing a delete action.
|
| |
template<concepts::initializes< T > T2>
requires concepts::not_same_as<std::remove_cvref_t<T2>, unique_handle> && concepts::not_same_as<std::remove_cvref_t<T2>, nullhandle_t> |
| !std ::convertible_to< T2 &&, T > constexpr | unique_handle (T2 &&value, const delete_action_type &deleteAction=delete_action_type{}) |
| | Constructor overload for initializing the value.
|
| |
template<concepts::assignable_to< T & > T2>
requires concepts::not_same_as<std::remove_cvref_t<T2>, unique_handle> && concepts::not_same_as<std::remove_cvref_t<T2>, nullhandle_t> && concepts::initializes<std::remove_cvref_t<T2>, T> |
| constexpr unique_handle & | operator= (T2 &&value) |
| | Assignment operator overload for assigning the value.
|
| |
template<class... TArgs>
requires std::constructible_from<T, TArgs...> |
| constexpr | unique_handle (std::in_place_t, TArgs &&... args) |
| | Constructor overload for directly initializing the value with a set of arguments.
|
| |
template<class... TArgs>
requires std::constructible_from<T, TArgs...> |
| constexpr | unique_handle (std::in_place_t, const delete_action_type &deleteAction, TArgs &&... args) |
| | Constructor overload for directly initializing the value with a set of arguments and also initializing the delete action.
|
| |
template<class... TArgs>
requires std::constructible_from<T, TArgs...> |
| SL_UNIQUE_HANDLE_FULL_CONSTEXPR void | emplace (TArgs &&... args) |
| | Constructor overload for directly initializing the value with a set of arguments.
|
| |
| SL_UNIQUE_HANDLE_FULL_CONSTEXPR void | reset () noexcept |
| | Resets the value and invokes the delete action if value was initialized.
|
| |
| constexpr const T & | raw () const |
| | Immutable access to the value. No checks will be performed.
|
| |
| constexpr const T & | operator* () const noexcept |
| | Immutable access to the value. No checks will be performed.
|
| |
| constexpr const T * | operator-> () const noexcept |
| | Immutable access to the value. No checks will be performed.
|
| |
| constexpr | operator bool () const noexcept |
| | Checks whether the value is initialized.
|
| |
| constexpr bool | is_valid () const noexcept |
| | Checks whether the value is initialized.
|
| |
| constexpr const delete_action_type & | delete_action () const noexcept |
| | Immutable access to the delete action.
|
| |
| template<std::equality_comparable_with< T > T2, class TOtherDeleteAction > |
| constexpr bool | operator== (const unique_handle< T2, TOtherDeleteAction > &other) const |
| | Equality-comparison operator overload between two unique_handles. operator != is implicitly defined.
|
| |
| template<std::three_way_comparable_with< T > T2, class TOtherDeleteAction > |
| constexpr std::compare_three_way_result_t< T, T2 > | operator<=> (const unique_handle< T2, TOtherDeleteAction > &other) const |
| | Three-way-comparison operator overload between two unique_handles.
|
| |
template<class T2 >
requires concepts::not_same_as<std::remove_cvref_t<T2>, unique_handle> && std::three_way_comparable_with<T, T2> |
| constexpr std::compare_three_way_result_t< T, T2 > | operator<=> (const T2 &other) const |
| | Three-way-comparison operator overload for comparison between a unique_handle and a value.
|
| |
template<class T2 >
requires concepts::not_same_as<std::remove_cvref_t<T2>, unique_handle> && std::equality_comparable_with<T, T2> |
| constexpr bool | operator== (const T2 &other) const |
| | Equality-comparison operator overload for comparison between a unique_handle and a value. operator != is implicitly defined.
|
| |
| constexpr bool | operator== (nullhandle_t) const noexcept |
| | Equality-comparison operator overload for comparison of unique_handle and nullhandle_t.
|
| |
| constexpr std::strong_ordering | operator<=> (nullhandle_t) const noexcept |
| | Three-way-comparison operator overload for comparison of unique_handle and nullhandle_t.
|
| |
template<value T, delete_action_for< T > TDeleteAction = default_delete_action>
class sl::unique_handle< T, TDeleteAction >
This type models some kind of std::optional behaviour but resets itself on move operations.
For more details and information about related components go to unique_handle group page.
- Template Parameters
-
| T | The type of the stored value |
| TDeleteAction | Type of the used delete action |