Skip to content
  • Carsten Gräser's avatar
    Add UniqueTypes_t helper template alias · 1763ef97
    Carsten Gräser authored
    For a given `template<class...> Target` and list of types `T...`
    the alias `UniqueTypes_t<Target, T...>`  refers the instatiated
    template `Target<S...>`, where `S...` is generated from `T...`
    by removing duplicate types.
    
    This is useful for `std::variant`, because duplicate types
    are not fully supported by some implementations. If your
    type list is generated by whatever mechanism where you don't
    have control over uniqueness, then `UniqueTypes_t<std::variant, T...>`
    is what `std::variant<T...>` should have been.
    
    This would fit into `typetraits.hh`. However, this would lead
    to a cyclic dependency of `typetraits.hh` and `std/type_traits.hh`.
    Hence I've put it into `typelist.hh` which conceptually also
    deals with type list, altough no `TypeList<...>` shows up
    in the interface of `UniqueTypes_t`.
    1763ef97