mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 18:53:40 -04:00
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux-x86_64 (appimage) (push) Waiting to run
citra-build / linux-x86_64 (appimage-wayland) (push) Waiting to run
citra-build / linux-x86_64 (gcc-nopch) (push) Waiting to run
citra-build / linux-arm64 (clang) (push) Waiting to run
citra-build / linux-arm64 (gcc-nopch) (push) Waiting to run
citra-build / macos (push) Waiting to run
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (googleplay) (push) Waiting to run
citra-build / android (vanilla) (push) Waiting to run
citra-build / docker (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-libretro / android (push) Waiting to run
citra-libretro / linux (push) Waiting to run
citra-libretro / windows (push) Waiting to run
citra-libretro / macos (arm64) (push) Waiting to run
citra-libretro / macos (x86_64) (push) Waiting to run
citra-libretro / ios (push) Waiting to run
citra-libretro / tvos (push) Waiting to run
citra-transifex / transifex (push) Waiting to run
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
// Copyright Citra Emulator Project / Azahar Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <optional>
|
|
#include <type_traits>
|
|
|
|
namespace detail {
|
|
template <typename T>
|
|
struct is_optional_trait : std::false_type {
|
|
using value_type = T;
|
|
};
|
|
|
|
template <typename T>
|
|
struct is_optional_trait<std::optional<T>> : 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<u32>;
|
|
* is_optional_type<Test1> -> false
|
|
* is_optional_type<Test2> -> true
|
|
*/
|
|
template <typename T>
|
|
inline constexpr bool is_optional_type = detail::is_optional_trait<T>::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<u32>;
|
|
* optional_value_type<Test1> -> u32
|
|
* optional_value_type<Test2> -> u32
|
|
*/
|
|
template <typename T>
|
|
using optional_inner_or_type = typename detail::is_optional_trait<T>::value_type;
|