Represents a set of types, based on sorted lists. More...
#include <TypeSet.hpp>
Public Types | |
using | ThisType = TypeSetImpl< Members > |
using | AsList = Members |
template<typename OtherSet > | |
using | unionWith = TypeSetImpl< typename Members::template uniqueMerge< typename OtherSet::AsList > > |
Union this set with another. More... | |
template<typename OtherSet > | |
using | intersectionWith = TypeSetImpl< decltype(intersectHelper< Members, typename OtherSet::AsList >())> |
Intersect this set with another. More... | |
template<typename OtherSet > | |
using | subtract = TypeSetImpl< decltype(subtractHelper< Members, typename OtherSet::AsList >())> |
Subtract another set from this one. More... | |
template<typename I > | |
using | add = unionWith< TypeSetImpl< TypeList< I > > > |
Add an element to the set. More... | |
template<typename I > | |
using | remove = subtract< TypeSetImpl< TypeList< I > > > |
Remove an element from the set. More... | |
template<template< typename > typename Lambda> | |
using | map = TypeSetImpl< typename Members::template map< Lambda > > |
Functional map. More... | |
template<typename Defer = Members> | |
using | head = typename Defer::template get< 0 > |
Get the first element. More... | |
template<typename Defer = Members> | |
using | tail = TypeSetImpl< typename Defer::template slice< 1 > > |
The set minus the first element (combine with first to iterate sets). More... | |
Static Public Member Functions | |
template<typename T > | |
static constexpr bool | contains () |
O(log(n)) More... | |
template<typename List1 , typename List2 , int I1 = 0, int I2 = 0, typename NewList = TypeList<>> | |
constexpr static auto | intersectHelper () |
Intersect two sorted lists of unique elements. More... | |
template<typename List1 , typename List2 , int I1 = 0, int I2 = 0, typename NewList = TypeList<>> | |
constexpr static auto | subtractHelper () |
Subtract List2 from List2. Both lists are sorted lists of unique elements. More... | |
Static Public Attributes | |
constexpr static int | Size = Members::Size |
constexpr static bool | Empty = Size == 0 |
Represents a set of types, based on sorted lists.
The types being stored must be sortable.
You probably want to access this using the TypeSet alias, and construct them through the AsTypeSet alias.
Members | A sorted sp::TypeList of the members of the set. |
using sp::TypeSetImpl< Members >::add = unionWith<TypeSetImpl<TypeList<I> >> |
Add an element to the set.
using sp::TypeSetImpl< Members >::head = typename Defer::template get<0> |
Get the first element.
using sp::TypeSetImpl< Members >::intersectionWith = TypeSetImpl<decltype(intersectHelper<Members, typename OtherSet::AsList>())> |
Intersect this set with another.
using sp::TypeSetImpl< Members >::map = TypeSetImpl<typename Members::template map<Lambda> > |
Functional map.
using sp::TypeSetImpl< Members >::remove = subtract<TypeSetImpl<TypeList<I> >> |
Remove an element from the set.
using sp::TypeSetImpl< Members >::subtract = TypeSetImpl<decltype(subtractHelper<Members, typename OtherSet::AsList>())> |
Subtract another set from this one.
using sp::TypeSetImpl< Members >::tail = TypeSetImpl<typename Defer::template slice<1> > |
The set minus the first element (combine with first to iterate sets).
using sp::TypeSetImpl< Members >::unionWith = TypeSetImpl<typename Members::template uniqueMerge<typename OtherSet::AsList> > |
Union this set with another.
|
staticconstexpr |
O(log(n))
|
staticconstexpr |
Intersect two sorted lists of unique elements.
|
staticconstexpr |
Subtract List2 from List2. Both lists are sorted lists of unique elements.