// Copyright Citra Emulator Project / Azahar Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include #include namespace detail { template struct is_optional_trait : std::false_type { using value_type = T; }; template struct is_optional_trait> : std::true_type { using value_type = T; }; } // namespace detail /** * Returns true if T is a std::optional, false otherwise. * For example: * using Test1 = u32; * using Test2 = std::optional; * is_optional_type -> false * is_optional_type -> true */ template inline constexpr bool is_optional_type = detail::is_optional_trait::value; /** * Provides the inner type of T if it is a std::optional, or T itself if it is not. * For example: * using Test1 = u32; * using Test2 = std::optional; * optional_value_type -> u32 * optional_value_type -> u32 */ template using optional_inner_or_type = typename detail::is_optional_trait::value_type;