Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Constraint_Set< T > Class Template Reference

Ordered collection of equality constraints. More...

#include <tpl_constraints.H>

Collaboration diagram for Aleph::Constraint_Set< T >:
[legend]

Public Member Functions

size_t size () const noexcept
 Returns the number of stored constraints.
 
bool empty () const noexcept
 Returns whether the set has no constraints.
 
void clear () noexcept
 Removes all stored constraints.
 
size_t add (const T &lhs, const T &rhs, const Source_Span &span={}, const std::string &message="")
 Appends an equality constraint.
 
const Equality_Constraint< T > & constraint (const size_t i) const
 Returns one stored constraint.
 

Private Attributes

DynArray< Equality_Constraint< T > > constraints
 

Detailed Description

template<typename T>
class Aleph::Constraint_Set< T >

Ordered collection of equality constraints.

Constraints are processed in insertion order to keep solver behavior deterministic and easy to test.

Template Parameters
TItem type compared by each equality constraint.

Definition at line 83 of file tpl_constraints.H.

Member Function Documentation

◆ add()

template<typename T >
size_t Aleph::Constraint_Set< T >::add ( const T &  lhs,
const T &  rhs,
const Source_Span &  span = {},
const std::string &  message = "" 
)
inline

Appends an equality constraint.

Parameters
lhsLeft-hand side.
rhsRight-hand side.
spanOptional source span.
messageOptional debug description.
Returns
New size after insertion.

Definition at line 114 of file tpl_constraints.H.

Referenced by main(), TEST(), and TEST().

◆ clear()

template<typename T >
void Aleph::Constraint_Set< T >::clear ( )
inlinenoexcept

Removes all stored constraints.

Definition at line 101 of file tpl_constraints.H.

References Aleph::Constraint_Set< T >::constraints.

◆ constraint()

template<typename T >
const Equality_Constraint< T > & Aleph::Constraint_Set< T >::constraint ( const size_t  i) const
inline

Returns one stored constraint.

Parameters
iConstraint index.
Returns
Stored equality constraint.
Exceptions
std::out_of_rangeIf i is invalid.

Definition at line 134 of file tpl_constraints.H.

References ah_out_of_range_error_unless, and Aleph::Constraint_Set< T >::constraints.

Referenced by Aleph::Compiler_Type_Unifier::solve().

◆ empty()

template<typename T >
bool Aleph::Constraint_Set< T >::empty ( ) const
inlinenoexcept

Returns whether the set has no constraints.

Definition at line 95 of file tpl_constraints.H.

References Aleph::Constraint_Set< T >::constraints.

◆ size()

template<typename T >
size_t Aleph::Constraint_Set< T >::size ( ) const
inlinenoexcept

Returns the number of stored constraints.

Definition at line 89 of file tpl_constraints.H.

References Aleph::Constraint_Set< T >::constraints.

Referenced by Aleph::Compiler_Type_Unifier::solve().

Member Data Documentation

◆ constraints


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