diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index 9939e0ccd3..a768f0c687 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -159,6 +159,7 @@ + diff --git a/Source/Core/Common/VariantUtil.h b/Source/Core/Common/VariantUtil.h new file mode 100644 index 0000000000..c865ad9681 --- /dev/null +++ b/Source/Core/Common/VariantUtil.h @@ -0,0 +1,26 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include + +namespace detail +{ +template +struct VariantCastProxy +{ + const std::variant& v; + + template + operator std::variant() const + { + return std::visit([](auto&& arg) { return std::variant{arg}; }, v); + } +}; +} // namespace detail + +template +auto VariantCast(const std::variant& v) +{ + return detail::VariantCastProxy{v}; +}