diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-03 08:18:55 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-03 08:18:55 +0100 |
| commit | 38b5c32b1037602068285dc3ad906cc7b94cdcb4 (patch) | |
| tree | d97b974e1c6b9bb4c26ffbd7499f87c9545b2d8f /compat | |
| parent | ea09c317db4d243e064da095370545e43ff4c0c7 (diff) | |
kill compat/optional
Diffstat (limited to 'compat')
| -rw-r--r-- | compat/optional.hpp | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/compat/optional.hpp b/compat/optional.hpp deleted file mode 100644 index 6f8a1a89..00000000 --- a/compat/optional.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include <type_traits> -#include <Corrade/Containers/Optional.h> - -namespace std { -template<class T> struct tuple_size<Corrade::Containers::Optional<T>> : std::integral_constant<std::size_t, 2> {}; -template<class T> struct tuple_element<0, Corrade::Containers::Optional<T>> { using type = T; }; -template<class T> struct tuple_element<1, Corrade::Containers::Optional<T>> { using type = bool; }; -} // namespace std - -namespace Corrade::Containers { - -template<std::size_t N, class T> -std::tuple_element_t<N, Optional<T>> -get(const Optional<T>& value) noexcept(std::is_nothrow_default_constructible_v<T> && std::is_nothrow_copy_constructible_v<T>) -{ - static_assert(N < 2); - static_assert(std::is_default_constructible_v<T> && std::is_copy_constructible_v<T>); - if constexpr (N == 0) - return value ? *value : T{}; - if constexpr (N == 1) - return bool(value); -} - -} // namespace Corrade::Containers |
