diff options
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 |
