Entt: `type_list_diff`: ability to remove types from type lists

Created on 14 Jan 2021  路  2Comments  路  Source: skypjack/entt

To complement type_list_cat it might be useful to generate type lists by removing types. This was discussed on discord https://discord.com/channels/707607951396962417/707624203456872480/799280425380872223.

Suggested snipped by @skypjack

template<typename, typename>
struct type_list_diff;

template<typename... Type, typename... Other>
struct type_list_diff<type_list<Type...>, type_list<Other...>> {
    using type = type_list_cat_t<std::conditional_t<type_list_contains_v<type_list<Other...>, Type>, type_list<>, type_list<Type>>...>;
};

template<typename... List>
using type_list_diff_t = typename type_list_diff<List...>::type;
enhancement

Most helpful comment

Available on experimental. 馃憤

All 2 comments

Available on experimental. 馃憤

Upstream on master.

Was this page helpful?
0 / 5 - 0 ratings