Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CSet< Key, Size > Class Template Reference

A constexpr set, like std::set but at compile time. More...

#include <Set.h>

Public Member Functions

consteval CSet (std::initializer_list< Key > keys)
 
template<std::forward_iterator Iter>
consteval CSet (Iter begin, Iter end)
 
 ~CSet ()=default
 
constexpr bool contains (const Key &key) const
 
constexpr size_t size () const
 
constexpr bool empty () const
 
constexpr auto cbegin () const
 
constexpr auto cend () const
 
constexpr auto begin () const
 
constexpr auto end () const
 

Detailed Description

template<std::totally_ordered Key, size_t Size>
class CSet< Key, Size >

A constexpr set, like std::set but at compile time.

This class is designed to implement a constexpr version of std::set.

When using this class, "class template argument deduction" will figure out the type and size for you:

constexpr CSet magicNumber{5738, 573942, 5832}; // --> CSet<int, 3>
A constexpr set, like std::set but at compile time.
Definition Set.h:43

If you want to force a type, but not the size, use the make_set helper function like:

constexpr auto mySet = make_set<std::string_view>({"one", "two", "three"});
consteval auto make_set(Key(&&k)[Size]) -> CSet< Key, Size >
Helper if the Key type of the CSet should be different than the provided values.
Definition Set.h:85

The elements in CSet need to be totally ordered, this allows for O(log n) complexity when looking up values.

Constructor & Destructor Documentation

◆ CSet() [1/2]

template<std::totally_ordered Key, size_t Size>
CSet< Key, Size >::CSet ( std::initializer_list< Key > keys)
inlineconsteval

◆ CSet() [2/2]

template<std::totally_ordered Key, size_t Size>
template<std::forward_iterator Iter>
CSet< Key, Size >::CSet ( Iter begin,
Iter end )
inlineconsteval

◆ ~CSet()

template<std::totally_ordered Key, size_t Size>
CSet< Key, Size >::~CSet ( )
default

Member Function Documentation

◆ begin()

template<std::totally_ordered Key, size_t Size>
auto CSet< Key, Size >::begin ( ) const
inlineconstexpr

◆ cbegin()

template<std::totally_ordered Key, size_t Size>
auto CSet< Key, Size >::cbegin ( ) const
inlineconstexpr

◆ cend()

template<std::totally_ordered Key, size_t Size>
auto CSet< Key, Size >::cend ( ) const
inlineconstexpr

◆ contains()

template<std::totally_ordered Key, size_t Size>
bool CSet< Key, Size >::contains ( const Key & key) const
inlineconstexpr

◆ empty()

template<std::totally_ordered Key, size_t Size>
bool CSet< Key, Size >::empty ( ) const
inlineconstexpr

◆ end()

template<std::totally_ordered Key, size_t Size>
auto CSet< Key, Size >::end ( ) const
inlineconstexpr

◆ size()

template<std::totally_ordered Key, size_t Size>
size_t CSet< Key, Size >::size ( ) const
inlineconstexpr

The documentation for this class was generated from the following file: