OpenEnroth 73e68f7
|
#include <AccessibleVector.h>
Public Types | |
using | const_iterator = decltype(std::declval< const Base * >() ->begin()) |
using | value_type = std::iter_value_t< const_iterator > |
using | const_reference = std::iter_reference_t< const_iterator > |
Public Member Functions | |
const_reference | operator[] (size_t index) const |
size_t | size () const |
const_reference | front () const |
const_reference | back () const |
AccessibleVector< value_type > | frontBack () const |
auto | delta () const |
AccessibleVector< value_type > | adjacentDeltas () const |
const_reference | min () const |
const_reference | max () const |
AccessibleVector< value_type > | minMax () const |
auto | flattened () const |
template<class Filter > | |
AccessibleVector< value_type > | filtered (Filter filter) const |
AccessibleVector< value_type > | reversed () const |
bool | contains (const value_type &value) const |
template<class... Args> | |
bool | containsAll (const Args &... args) const |
template<class... Args> | |
bool | containsAny (const Args &... args) const |
template<class Predicate > requires std::is_invocable_v<Predicate, value_type> | |
bool | contains (Predicate predicate) const |
Friends | |
AccessibleVector< value_type > | calculateDelta (const Accessible &l, const Accessible &r) |
Extension class that adds a couple methods to a container that makes writing tests easier.
The methods themselves might remind you of what's available in Java 8 Stream API, or in std::ranges
, but the underlying implementation here is very dumb and doesn't even try to be fast. Every method allocates, so this class isn't suitable for runtime usage - use std::ranges
instead.
Aside from the useful methods, Accessible
also provides an operator==
that makes it possible to compare any two Accessible
classes as long as their elements are comparable.
using Accessible< Base >::const_iterator = decltype(std::declval<const Base *>()->begin()) |
using Accessible< Base >::const_reference = std::iter_reference_t<const_iterator> |
using Accessible< Base >::value_type = std::iter_value_t<const_iterator> |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |