Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Range

 

U++ algorithms are designed to work on Ranges. Range is a type that has (at minimum)

 

Standard begin() / end() methods.

GetCount() that returns the number of elements in Range (can be implemented as end - begin)

operator[] (can be implemented as begin()[i])

 

Standard Ranges usually also implement ToString and comparisons (if it is possible).

 

Usually, Range is either U++ container or just some part of it.

 

U++ provides these Range related typedefs and template functions:

 


 

template <class Range> using ValueTypeOf;

Returns the type of elements of Range.

 


 

template <class Range> using IteratorOf;

template <class Range> using ConstIteratorOf'

Returns the type of Iterator / ConstIterator of range.

 


 

template <class I

SubRangeClass<ISubRange(I begin, I end)

Makes a Range based on begin/end iterators.

 


 

template <class I

SubRangeClass<ISubRange(I begin, int count)

Makes a Range based on begin iterator and count.

 


 

template <class C

auto SubRange(C& c, int pos, int count);

template <class C

auto SubRange(const C& c, int pos, int count);

Makes a Range as subrange of some other Range (e.g. container).

 


 

template <class Range> using SubRangeOf;

Returns the type of SubRange of some Range.

 


 

template <class T

ConstRangeClass<TConstRange(const T& value, int count)

Creates a Range of count elements equal to value.

 


 

template <class BaseRange

ViewRangeClass<BaseRangeViewRange(BaseRange& r, Vector<int>&& ndx)

Creates a view of BaseRange r based on mapping ndx. Element at ndx[0] becomes a first element of a new Range, ndx[1] second etc..

 


 

template <class BaseRange, class Predicate

ViewRangeClass<BaseRangeFilterRange(BaseRange& r, Predicate p)

Same as ViewRangeClass<BaseRange>(r, FindAll(r, p)). Creates a view of elements of master Range that satisfy condition p.

 

 

Last edit by cxl on 11/19/2016. Do you want to contribute?. T++