|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Integer range domain [start, end] with optional step. More...
#include <al-domain.H>
Public Member Functions | |
| IntRange ()=delete | |
| Deleted default constructor (range required) | |
| IntRange (const int start, const int end, const int step=1) | |
| Construct range [start, end] with step. | |
| IntRange (const size_t n) | |
| Construct range [0, n-1]. | |
Public Member Functions inherited from Aleph::AlDomain< int > | |
| const DynList< int > & | keys () const |
| Get sorted list of all elements in the domain. | |
| int * | insert (const int &key) |
Insert key, as HashSet::insert(), and forget the sorted keys. | |
| int * | insert (int &&key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| int * | search_or_insert (const int &key) |
Search or insert key, as HashSet::search_or_insert(), and forget the sorted keys. | |
| int * | search_or_insert (int &&key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::pair< int *, bool > | contains_or_insert (const int &key) |
Search or insert key, as HashSet::contains_or_insert(), and forget the sorted keys. | |
| std::pair< int *, bool > | contains_or_insert (int &&key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| int * | append (const int &key) |
Insert key, as HashSet::append(), and forget the sorted keys. | |
| int * | append (int &&key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| void | add (const DynList< int > &l) |
Insert the keys of l, as HashSet::add(), and forget the sorted keys. | |
| void | remove (const int &key) |
Remove key, as HashSet::remove(), and forget the sorted keys. | |
| void | remove_ptr (int *key) |
Remove the key that key points to, as HashSet::remove_ptr(), and forget the sorted keys. | |
| void | empty () |
| Remove every key, as HashSet::empty(), and forget the sorted keys. | |
| void | clear () |
| Remove every key, as HashSet::clear(), and forget the sorted keys. | |
| void | swap (AlDomain &other) noexcept |
Swap the keys, and the sorted keys, with other. | |
| DynList< int > | to_list () const |
| Convert domain to sorted list. | |
| std::string | to_str () const and AlStreamable< int > |
| Convert domain to string representation. | |
Public Member Functions inherited from Aleph::HashSet< Key, HashSetTable, Cmp > | |
| void | add (const DynList< Key > &l) |
| template<template< typename > class List> | |
| HashSet (const List< Key > &l) | |
| template<class It > requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; }) | |
| HashSet (It b, It e) | |
| HashSet (std::initializer_list< Key > l) | |
| HashSet () | |
| const Key & | get_first () const |
| const Key & | get_last () const |
| void | clear () |
| Empties the container. | |
| bool | is_empty () const noexcept |
| Checks if the container is empty. | |
Additional Inherited Members | |
Public Types inherited from Aleph::AlDomain< int > | |
| using | Base = Aleph::HashSet< int, SetODhash > |
| typedef HashSetTable< Key, Cmp > | Base |
Public Types inherited from Aleph::HashSet< Key, HashSetTable, Cmp > | |
| typedef HashSetTable< Key, Cmp > | Base |
Static Public Member Functions inherited from Aleph::AlDomain< int > | |
| static AlDomain | build (Items &&... items) |
Static Public Member Functions inherited from Aleph::HashSet< Key, HashSetTable, Cmp > | |
| template<typename... Items> requires requires (Items &&... items) { HashSet ::template build_as< HashSet >(std::forward<Items>(items)...); } | |
| static HashSet | build (Items &&... items) |
Integer range domain [start, end] with optional step.
Specialized domain for integer ranges, commonly used as indices for sparse matrices and vectors.
| Constructor | Result |
|---|---|
| IntRange(5) | {0, 1, 2, 3, 4} |
| IntRange(0, 4) | {0, 1, 2, 3, 4} |
| IntRange(0, 10, 2) | {0, 2, 4, 6, 8, 10} |
Definition at line 310 of file al-domain.H.
|
delete |
Deleted default constructor (range required)
|
inline |
Construct range [start, end] with step.
| start | First value in range |
| end | Last value in range (inclusive) |
| step | Increment between values (default 1) |
| std::domain_error | if step is not positive |
Definition at line 329 of file al-domain.H.
References ah_domain_error_if, and Aleph::AlDomain< int >::insert().
|
inline |
Construct range [0, n-1].
| n | Number of elements (0 to n-1) |
| std::domain_error | if n - 1 does not fit in an int, as for a negative int converted to size_t |
Definition at line 352 of file al-domain.H.
References ah_domain_error_if, and Aleph::AlDomain< int >::insert().