#ifndef ARGPARSER_DISTINCT_TYPES_H #define ARGPARSER_DISTINCT_TYPES_H #include #include namespace argparser::internal::distinct_types_impl { template struct UniqueTypes; template typename X, typename... Ts> struct UniqueTypes> { using type = X; }; template typename X, typename... Ts, typename T, typename... Us> struct UniqueTypes, T, Us...> { using type = typename UniqueTypes< typename std::conditional< std::disjunction...>::value, X, X>::type, Us...>::type; }; template typename X, typename... Ts> struct Distinct { using type = typename UniqueTypes, Ts...>::type; }; }// namespace argparser::internal::distinct_types_impl namespace argparser::internal { template using distinct_types_variant = typename internal::distinct_types_impl::Distinct::type; template using distinct_types_tuple = typename internal::distinct_types_impl::Distinct::type; template using if_single_type = std::enable_if_t>::value == 1, T>; template using if_not_single_type = std::enable_if_t<(std::tuple_size>::value > 1), T>; template using single_type_conditional = std::conditional<(std::tuple_size>::value == 1), T, F>; template using single_type = if_single_type>::type, Ts...>; }// namespace argparser::internal #endif// ARGPARSER_DISTINCT_TYPES_H