Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ah-concepts.H File Reference

C++20 concepts hub: comparison, BST policy, and Aleph container concepts. More...

#include <concepts>
#include <type_traits>
#include <cstddef>
#include <functional>
#include <utility>
Include dependency graph for ah-concepts.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::concepts_detail::defer< T, Deferred >
 T itself, made dependent on Deferred. More...
 
struct  Aleph::concepts_detail::traverse_arg< Container, Deferred >
 What Container::Iterator::get_curr() yields, deferred. More...
 
struct  Aleph::concepts_detail::invoke_as< R(A...)>
 Calls a callable exactly as std::function<R(A...)> would. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::concepts_detail
 

Concepts

concept  Aleph::BinaryPredicate
 A callable that takes two const T& and returns bool.
 
concept  Aleph::StrictWeakOrder
 Strict weak ordering constraint for BST comparators.
 
concept  Aleph::EqualityComparator
 Equivalence relation constraint for equality comparators.
 
concept  Aleph::BSTPolicy
 Concept for BST tree policies used by DynSetTree.
 
concept  Aleph::AlephArrayConvertible
 Concept that identifies types that can be converted or used as an Aleph Array.
 
concept  Aleph::AlephSequentialContainer
 Concept for Aleph-w mutable sequential containers.
 
concept  Aleph::AlephSequentialIterableContainer
 Concept for Aleph-w sequential containers that can be iterated.
 
concept  Aleph::AlephIterator
 An Aleph cursor-style iterator, as generic library code uses it.
 
concept  Aleph::AlephIterable
 A type that yields an AlephIterator over its Item_Types.
 
concept  Aleph::AlephTraversable
 A container whose items can be visited with traverse().
 
concept  Aleph::AlephIterableContainer
 A traversable, AlephIterable container with a size.
 
concept  Aleph::AlephSequence
 An iterable container that grows at its back with append().
 
concept  Aleph::StlIterableContainer
 A container with STL-style begin()/end() and value_type.
 
concept  Aleph::IntegerSortableValue
 Integral value accepted by linear-time integer sorting algorithms.
 
concept  Aleph::ArrayStorable
 An element type the Aleph arrays can store.
 
concept  Aleph::ClosedBinaryOp
 A binary functor closed over T.
 
concept  Aleph::StaticMonoid
 A static monoid: M::identity() and M::combine(a, b).
 
concept  Aleph::CallableWith
 f(args...) is a valid call expression, exactly as written.
 
concept  Aleph::PredicateWith
 f(args...) is a valid call whose result is usable as a condition.
 
concept  Aleph::concepts_detail::BinNodeLikeImpl
 Unqualified form of BinNodeLike, applied to a cv-free node type.
 
concept  Aleph::BinNodeLike
 A binary tree node usable by tpl_binNodeUtils.H.
 
concept  Aleph::RankedBinNodeLike
 A binary tree node that also keeps subtree sizes (rank).
 

Detailed Description

C++20 concepts hub: comparison, BST policy, and Aleph container concepts.

Defines twenty-one concepts used throughout Aleph-w to constrain template parameters (graph concepts live in ah-graph-concepts.H):

  • BinaryPredicate<F, T> — base concept: f(a, b) returns something convertible to bool.
  • StrictWeakOrder<F, T> — wraps std::strict_weak_order for BST comparators, invoked the way BST classes actually call them: through a const F&.
  • EqualityComparator<F, T> — wraps std::equivalence_relation for hash table equality comparators, likewise invoked through const F&.
  • BSTPolicy<T, Key> — minimal interface a Tree<Key, Compare> instantiation must expose to be usable by DynSetTree.
  • AlephArrayConvertible<T> — exposes Item_Type and get_it().
  • AlephSequentialContainer<C> — Aleph mutable sequential container interface (size, is_empty, append, mutable_for_each).
  • AlephSequentialIterableContainer<C> — refines the above with a const-iterable get_it().
  • IntegerSortableValue<T> — integral type accepted by counting/radix sort, excluding bool.
  • ArrayStorable<T> — element type that Array, MemArray and DynArray can allocate (new T[n]) and grow (by moving elements).
  • ClosedBinaryOp<F, T> — f(a, b) on two const T& returns something convertible to T (segment/Fenwick/sparse tables).
  • StaticMonoid<M, T> — M::identity() and M::combine(a, b).
  • CallableWith<F, Args...> — f(args...) is valid exactly as written.
  • PredicateWith<F, Args...> — f(args...) is valid and usable as a condition (contextual conversion to bool).
  • BinNodeLike<Node> — binary tree node protocol (getL, getR, get_key, NullPtr).
  • RankedBinNodeLike<Node> — BinNodeLike plus subtree sizes.
  • Container/iterator hierarchy: AlephIterator<It> (has_curr, get_curr, next_ne), AlephIterable<C> (yields one built from the container, Iterator(c)), AlephTraversable<C> (traverse), AlephIterableContainer<C> (both, plus size/is_empty), AlephSequence<C> (plus append), and StlIterableContainer<C> (begin/end/value_type).

Using distinct concept names produces clear error messages: a BST constraint failure mentions "StrictWeakOrder", while a hash table failure mentions "EqualityComparator".

Author
Leandro Rabindranath Leon

Definition in file ah-concepts.H.