1 #pragma once 2 3 #include <concepts> 4 #include <variant> 5 6 namespace utils 7 { 8 namespace details 9 { 10 11 template <class T, class... Args> 12 auto removeMonostate(std::variant<T, Args...>) -> std::variant<T, Args...>; 13 14 template <class... Args> 15 auto removeMonostate(std::variant<std::monostate, Args...>) 16 -> std::variant<Args...>; 17 18 template <class Variant> 19 struct WithoutMonostate 20 { 21 private: 22 public: 23 using type = decltype(removeMonostate(Variant{})); 24 }; 25 26 } // namespace details 27 28 template <class Variant> 29 using WithoutMonostate = typename details::WithoutMonostate<Variant>::type; 30 31 } // namespace utils 32