FE 0.14.0
A C++23 toolkit for writing compiler/interpreter frontends.
Loading...
Searching...
No Matches
fe::Patricia< D, KT, K, N >::Set Class Reference

An immutable set - really just a tagged pointer, so copy it around freely. More...

#include <fe/patricia.h>

Classes

class  iterator
 Yields the D* in ascending Key::key order. More...

Public Member Functions

Construction
constexpr Set () noexcept=default
 The empty set.
constexpr Set (D *d) noexcept
 The singleton \(\{d\}\) - stored inline, so this allocates nothing.
Getters
size_t size () const noexcept
constexpr bool empty () const noexcept
constexpr operator bool () const noexcept
 Not empty?
D * min () const noexcept
 Smallest id - or nullptr.
D * max () const noexcept
 Largest id - or nullptr.
Check Membership
bool contains (D *d) const noexcept
bool has_intersection (Set other) const noexcept
 Is \(this \cap other \neq \emptyset\)?
bool subset_of (Set other) const noexcept
 Is \(this \subseteq other\)?
Iterators

Ascending by id, compared as unsigned.

iterator begin () const noexcept
iterator end () const noexcept
template<class F>
void for_each (F &&f) const
 Like iterating, but without the iterator's path stack.
Comparisons

Everything is hash-consed and a singleton is always Uniq, so this compares contents in O(1).

constexpr bool operator== (Set other) const noexcept
Output
std::ostream & stream (std::ostream &os) const
void dump () const
void dot (std::ostream &os) const

Friends

class Patricia
std::ostream & operator<< (std::ostream &os, Set s)

Detailed Description

template<class D, class KT, class K = uint32_t, size_t N = 8>
class fe::Patricia< D, KT, K, N >::Set

An immutable set - really just a tagged pointer, so copy it around freely.

Definition at line 143 of file patricia.h.

Constructor & Destructor Documentation

◆ Set() [1/2]

template<class D, class KT, class K = uint32_t, size_t N = 8>
fe::Patricia< D, KT, K, N >::Set::Set ( )
constexprdefaultnoexcept

◆ Set() [2/2]

template<class D, class KT, class K = uint32_t, size_t N = 8>
fe::Patricia< D, KT, K, N >::Set::Set ( D * d)
inlineexplicitconstexprnoexcept

The singleton \(\{d\}\) - stored inline, so this allocates nothing.

Definition at line 269 of file patricia.h.

Member Function Documentation

◆ begin()

template<class D, class KT, class K = uint32_t, size_t N = 8>
iterator fe::Patricia< D, KT, K, N >::Set::begin ( ) const
inlinenoexcept

◆ contains()

template<class D, class KT, class K = uint32_t, size_t N = 8>
bool fe::Patricia< D, KT, K, N >::Set::contains ( D * d) const
inlinenoexcept

Definition at line 292 of file patricia.h.

◆ dot()

template<class D, class KT, class K = uint32_t, size_t N = 8>
void fe::Patricia< D, KT, K, N >::Set::dot ( std::ostream & os) const
inline

Definition at line 382 of file patricia.h.

References dot().

Referenced by dot().

◆ dump()

template<class D, class KT, class K = uint32_t, size_t N = 8>
void fe::Patricia< D, KT, K, N >::Set::dump ( ) const
inline

Definition at line 380 of file patricia.h.

References stream().

◆ empty()

template<class D, class KT, class K = uint32_t, size_t N = 8>
bool fe::Patricia< D, KT, K, N >::Set::empty ( ) const
inlineconstexprnoexcept

◆ end()

template<class D, class KT, class K = uint32_t, size_t N = 8>
iterator fe::Patricia< D, KT, K, N >::Set::end ( ) const
inlinenoexcept

Definition at line 341 of file patricia.h.

◆ for_each()

template<class D, class KT, class K = uint32_t, size_t N = 8>
template<class F>
void fe::Patricia< D, KT, K, N >::Set::for_each ( F && f) const
inline

Like iterating, but without the iterator's path stack.

Definition at line 345 of file patricia.h.

◆ has_intersection()

template<class D, class KT, class K = uint32_t, size_t N = 8>
bool fe::Patricia< D, KT, K, N >::Set::has_intersection ( Set other) const
inlinenodiscardnoexcept

Is \(this \cap other \neq \emptyset\)?

Definition at line 295 of file patricia.h.

References empty(), has_intersection(), and fe::unreachable().

Referenced by has_intersection().

◆ max()

template<class D, class KT, class K = uint32_t, size_t N = 8>
D * fe::Patricia< D, KT, K, N >::Set::max ( ) const
inlinenoexcept

Largest id - or nullptr.

Definition at line 287 of file patricia.h.

◆ min()

template<class D, class KT, class K = uint32_t, size_t N = 8>
D * fe::Patricia< D, KT, K, N >::Set::min ( ) const
inlinenoexcept

Smallest id - or nullptr.

Definition at line 286 of file patricia.h.

◆ operator bool()

template<class D, class KT, class K = uint32_t, size_t N = 8>
fe::Patricia< D, KT, K, N >::Set::operator bool ( ) const
inlineexplicitconstexprnoexcept

Not empty?

Definition at line 284 of file patricia.h.

References empty().

◆ operator==()

template<class D, class KT, class K = uint32_t, size_t N = 8>
bool fe::Patricia< D, KT, K, N >::Set::operator== ( Set other) const
inlineconstexprnoexcept

Definition at line 361 of file patricia.h.

◆ size()

template<class D, class KT, class K = uint32_t, size_t N = 8>
size_t fe::Patricia< D, KT, K, N >::Set::size ( ) const
inlinenoexcept

Definition at line 277 of file patricia.h.

References empty().

Referenced by subset_of().

◆ stream()

template<class D, class KT, class K = uint32_t, size_t N = 8>
std::ostream & fe::Patricia< D, KT, K, N >::Set::stream ( std::ostream & os) const
inline

Definition at line 366 of file patricia.h.

Referenced by dump(), and operator<<.

◆ subset_of()

template<class D, class KT, class K = uint32_t, size_t N = 8>
bool fe::Patricia< D, KT, K, N >::Set::subset_of ( Set other) const
inlinenodiscardnoexcept

Is \(this \subseteq other\)?

Definition at line 318 of file patricia.h.

References empty(), size(), and subset_of().

Referenced by subset_of().

◆ operator<<

template<class D, class KT, class K = uint32_t, size_t N = 8>
std::ostream & operator<< ( std::ostream & os,
Set s )
friend

Definition at line 455 of file patricia.h.

References stream().

◆ Patricia

template<class D, class KT, class K = uint32_t, size_t N = 8>
friend class Patricia
friend

Definition at line 454 of file patricia.h.

References Patricia.

Referenced by Patricia.


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