#include <Range_fwd.hpp>
An extension of std::vector<T> to support additional useful operations.
It only adds new methods, no new members, so destructing via base pointer is still safe (even though this usage is not intended).
Usage example:
Definition at line 30 of file Range_fwd.hpp.
Inheritance diagram for mm::Range< T, Allocator >:
Collaboration diagram for mm::Range< T, Allocator >:Public Member Functions | |
| Range (const Range &o)=default | |
| Default copy constructor. More... | |
| Range (Range &&o) noexcept=default | |
| Default move constructor. More... | |
| Range & | operator= (const Range &o)=default |
| Default copy assignment. More... | |
| Range & | operator= (Range &&o) noexcept=default |
| Default move assignment. More... | |
| Range (const std::vector< T, Allocator > &o) | |
Copy construct from std::vector. More... | |
| Range (std::vector< T, Allocator > &&o) noexcept | |
Move Construct from std::vector. More... | |
| Range (const Range::RangeView &o) | |
Construct from RangeView. More... | |
| Range (const Range::ConstRangeView &o) | |
Construct from ConstRangeView. More... | |
| Range & | operator= (std::initializer_list< value_type > lst) |
Assign from initializer list: a = {1, 2, 3};. More... | |
| Range & | operator= (const value_type &x) |
Assign a single value to all elements: a = 4;. More... | |
| reference | operator[] (size_type i) |
Overload vector's [] to assert parameter. More... | |
| const_reference | operator[] (size_type i) const |
Overload vector's [] to assert parameter. More... | |
| RangeView | operator[] (const indexes_t &indexes) |
| Multi-indexed access for writing. More... | |
| ConstRangeView | operator[] (const indexes_t &indexes) const |
| Multi-indexed access for reading. More... | |
| int | size () const |
| Returns number of elements. More... | |
| Range & | append (const Range &rng) |
Append all elements of rng to self. More... | |
| Range & | operator+= (const Range &rng) |
| Operator version of Range::append. More... | |
| Range | join (const Range &rng) const |
Return new copy containing this range's elements followed by all elements of rng. More... | |
| void | remove (indexes_t indexes) |
| Remove elements wih given indexes. More... | |
| template<class Predicate > | |
| indexes_t | filter (const Predicate &predicate) const |
Returns list of indexes for which predicate returns true. More... | |
| template<typename UnaryOp > | |
| auto | map (UnaryOp op) -> Range< decltype(op(this->operator[](0)))> const |
Returns a new range, obtained by applying op to all elements of this Range. More... | |
| indexes_t | operator< (const value_type &v) const |
Returns list of indexes of elements that are less than v. More... | |
| indexes_t | operator> (const value_type &v) const |
Returns list of indexes of elements that are greater than v. More... | |
| indexes_t | operator<= (const value_type &v) const |
Returns list of indexes of elements that are less or equal to v. More... | |
| indexes_t | operator>= (const value_type &v) const |
Returns list of indexes of elements that are greater or equal to v. More... | |
| indexes_t | operator== (const value_type &v) const |
Returns list of indexes of elements that are equal to v. More... | |
| indexes_t | operator!= (const value_type &v) const |
Returns list of indexes of elements that are not equal to v. More... | |
Static Public Member Functions | |
| template<typename V > | |
| static Range | seq (V n) |
Returns range {0, ..., n-1}. More... | |
| template<typename V > | |
| static Range | seq (V start, V stop) |
Returns range with integers in interval [start, stop). More... | |
| template<typename V , typename D > | |
| static Range | seq (V start, V stop, D step) |
Returns range with integers in interval [start, stop) with step step. More... | |
Public Types | |
| typedef std::vector< T, Allocator >::value_type | value_type |
| This container's value type. More... | |
| typedef std::vector< T, Allocator >::reference | reference |
| This container's reference to value type. More... | |
| typedef std::vector< T, Allocator >::const_reference | const_reference |
| This container's const reference to value type. More... | |
| typedef int | size_type |
| This container's size type. More... | |
Classes | |
| class | ConstRangeView |
| This class represents a non contiguous view to a Range, allowing for read-only operations. More... | |
| class | RangeView |
| This class represents a non contiguous view to a Range, allowing for read and write operations. More... | |
|
default |
Default copy constructor.
|
defaultnoexcept |
Default move constructor.
|
inline |
Copy construct from std::vector.
Definition at line 147 of file Range_fwd.hpp.
|
inlinenoexcept |
Move Construct from std::vector.
Definition at line 149 of file Range_fwd.hpp.
|
inline |
Construct from RangeView.
Definition at line 151 of file Range_fwd.hpp.
|
inline |
Construct from ConstRangeView.
Definition at line 153 of file Range_fwd.hpp.
| indexes_t mm::Range< T, Allocator >::filter | ( | const Predicate & | predicate | ) | const |
Returns list of indexes for which predicate returns true.
| Predicate | Any callable object, e.g. lambda func, functional, class with operator() defined. Example: auto idxs = a.filter([](double v){ return 2.3 < v && v < 6.4; })];
|
| indexes_t mm::Range< T, Allocator >::operator!= | ( | const value_type & | v | ) | const |
|
inline |
Operator version of Range::append.
Definition at line 190 of file Range_fwd.hpp.
| indexes_t mm::Range< T, Allocator >::operator< | ( | const value_type & | v | ) | const |
| indexes_t mm::Range< T, Allocator >::operator<= | ( | const value_type & | v | ) | const |
|
default |
Default copy assignment.
| Range< T, Allocator > & mm::Range< T, Allocator >::operator= | ( | const value_type & | x | ) |
|
defaultnoexcept |
Default move assignment.
| Range< T, Allocator > & mm::Range< T, Allocator >::operator= | ( | std::initializer_list< value_type > | lst | ) |
| indexes_t mm::Range< T, Allocator >::operator== | ( | const value_type & | v | ) | const |
| indexes_t mm::Range< T, Allocator >::operator> | ( | const value_type & | v | ) | const |
| indexes_t mm::Range< T, Allocator >::operator>= | ( | const value_type & | v | ) | const |
| Range< T, Allocator >::ConstRangeView mm::Range< T, Allocator >::operator[] | ( | const indexes_t & | indexes | ) | const |
| Range< T, Allocator >::const_reference mm::Range< T, Allocator >::operator[] | ( | size_type | i | ) | const |
|
static |
Returns range {0, ..., n-1}.
|
static |
Returns range with integers in interval [start, stop).
|
static |
Returns range with integers in interval [start, stop) with step step.
|
inline |
Returns number of elements.
std::vector::size. Definition at line 185 of file Range_fwd.hpp.