Range concepts¶
Table of Contents
Range¶
See details here :
Let Rng be a type that models Range (details).
Then Rng also models Semiregular (fundamentals).
Expressions
- Let :
rngbe an instance of Rng.rng_cpybe an instance of Rng.crngbe an instance of const Rng.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
rng() |
Rng | none | none | Constructs a range rng of type Rng |
crng() |
const Rng | none | none | Constructs a range crng of type Rng |
rng_cpy(rng) |
Rng | none | none | Copy-constructs a range rng_cpy from rng |
rng_cpy(crng) |
Rng | none | none | Copy-constructs a range rng_cpy from crng |
rng_cpy(move(rng)) |
Rng | none | none | Move-constructs a range rng_cpy from rng |
rng_cpy = rng |
Rng& | none | none | Assign rng to rng_cpy |
rng_cpy = crng |
Rng& | none | none | Assign crng to rng_cpy |
rng_cpy = move(rng) |
Rng& | none | none | Move-assign rng to rng_cpy |
rng.begin() |
/* implementation defined */ |
none | none | Return the begining of the range moving forward |
rng.end() |
/* implementation defined */ |
none | none | Return the end of the range moving forward |
crng.cbegin() |
/* implementation defined */ |
none | none | Return the const begining of the range moving forward |
crng.cend() |
/* implementation defined */ |
none | none | Return the const end of the range moving forward |
SizedRange¶
See details here :
Let SRng be a type that models SizedRange (details).
Then SRng also models Range.
Types
Then we can define :
| Definition | Description | Requirement |
|---|---|---|
| SRng::iterator_type | type of the iterator | models Iterator (fundamentals) concept |
Expressions
Let IRng inherit all valid expressions defined for Range.
- Let :
csrngbe an instance of const SRng.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
csrng.size() |
SRng::iterator_type::difference_type | none | none | Return the size of the range |
InputRange¶
See details here :
Let IRng be a type that models InputRange (details).
Then IRng also models Range.
Types
Then we can define :
| Definition | Description | Requirement |
|---|---|---|
| IRng::iterator_type | type of the iterator | models InputIterator (fundamentals) concept |
Expressions
Let IRng inherit all valid expressions defined for Range.
- Let :
itbe an instance of IRng::iterator_type.citbe an instance of const IRng::iterator_type.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
++it |
iterator_type& | none | none | Pre-increment the iterator |
it++ |
/* implementation defined*/ | none | not required to be equality preserving | Post-increment the iterator |
*cit |
auto&& | none | none | Dereference the iterator |
OutputRange¶
See details here :
Let (ORng, T) be a the pair of type that models OutputRange (details).
Then ORng also models Range.
Types
Then we can define :
| Definition | Description | Requirement |
|---|---|---|
| IRng::iterator_type | type of the iterator | models OutputIterator (fundamentals) concept |
Expressions
Let ORng inherit all valid expressions defined for Range.
- Let :
obe an instance of ORng::iterator_type.cobe an instance of const ORng::iterator_type.tbe an instance of T.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
++o |
iterator_type& | none | none | Pre-increment the iterator |
o++ |
/* implementation defined*/ | none | not required to be equality preserving | Post-increment the iterator |
*co |
auto&& | none | none | Dereference the iterator |
*o++ = forward<T>(t) |
/* implementation defined*/ | none | not required to be equality preserving | |
*o = forward<T>(t) |
/* implementation defined*/ | none | not required to be equality preserving | |
*forward<iterator_type>(o) = forward<T>(t) |
/* implementation defined*/ | none | not required to be equality preserving | |
const_cast<const iterator_type::reference&&>(*o) = forward<T>(t) |
/* implementation defined*/ | none | not required to be equality preserving | |
const_cast<const iterator_type::reference&&>(*forward<iterator_type>(o)) = forward<T>(t) |
/* implementation defined*/ | none | not required to be equality preserving |
ForwardRange¶
See details here :
Let FwdRng be a type that models ForwardRange (details).
Then FwdRng also models InputRange.
Types
Let FwdRng inherit all types defined for InputRange.
Then we can define :
| Definition | Description | Requirement |
|---|---|---|
| FwdRng::iterator_type | type of the iterator | models ForwardIterator (fundamentals) concept |
| FwdRng::value_type | type of the value | models Value concept |
Expressions
Let FwdRng inherit all valid expressions defined for InputRange.
- Let :
itbe an instance of FwdRng::iterator_type.lhsbe an instance of const FwdRng::iterator_type.rhsbe an instance of const FwdRng::iterator_type.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
lhs == rhs |
bool | none | none | Compare wether two iterators are equals |
lhs != rhs |
bool | none | none | Compare wether two iterators are different |
rhs == lhs |
bool | none | none | Compare wether two iterators are equal |
rhs != lhs |
bool | none | none | Compare wether two iterators are different |
it++ |
iterator_type&& | none | none | Go to the next element by post-increment |
BidirectionalRange¶
Let BidirRng be a type that models BidirectionalRange (details).
Then BidirRng also models : ForwardRange.
Types
Let BidirRng inherit all types defined for ForwardRange.
Then we can define :
| Definition | Description | Requirement |
|---|---|---|
| FwdRng::iterator_type | type of the iterator | models BidirectionalIterator (fundamentals) concept |
Expressions
Let BidirRng inherit all valid expressions defined for ForwardRange.
- Let :
itbe an instance of BidirRng::iterator_type.bidirrngbe an instance of BidirRng.cbidirrngbe an instance of const BidirRng.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
--it |
iterator_type& | none | none | Pre-decrement the iterator |
it-- |
iterator_type&& | none | none | Post-decrement the iterator |
cbidirrng.rbegin() |
/* implementation defined */ |
none | none | Return the begining of the range moving backward |
cbidirrng.rend() |
/* implementation defined */ |
none | none | Return the end of the range moving backward |
cbidirrng.crbegin() |
/* implementation defined */ |
none | none | Return the const begining of the range moving backward |
cbidirrng.crend() |
/* implementation defined */ |
none | none | Return the const end of the range moving backward |
RandomAccessRange¶
Let RndAccRng be a type that models RandomAccessRange (details).
Then RndAccRng also models BidirectionalRange.
Types
Let RndAccRng inherit all types defined for BidirectionalRange.
Then we can define :
| Definition | Description | Requirement |
|---|---|---|
| RndAccRng::iterator_type | type of the iterator | models RandomAccessIterator (fundamentals) concept |
Expressions
Let RndAccRng inherit all valid expressions defined for BidirectionalRange.
- Let :
itbe an instance of RndAccRng::iterator_type.citbe an instance of const RndAccRng::iterator_type.lhsbe an instance of const RndAccRng::iterator_type.rhsbe an instance of const RndAccRng::iterator_type.nbe an instance of RndAccRng::iterator_type::difference_type.
Then we have the following valid expressions :
| Expression | Return type | Pre-condition | Post-condition | Description |
|---|---|---|---|---|
lhs < rhs |
bool | none | none | Compare order of the two ranges |
lhs > rhs |
bool | none | none | Compare order of the two ranges |
lhs <= rhs |
bool | none | none | Compare order of the two ranges |
lhs >= rhs |
bool | none | none | Compare order of the two ranges |
it += n |
iterator_type& | none | none | Jump forward of n elements |
|
iterator_type&& | none | none | Return a range that jumped forward of n elements |
it -= n |
iterator_type& | none | none | Jump backward of n elements |
|
iterator_type&& | none | none | Return a range that jumped backward of n elements |
cit[n] |
iterator_type::reference | none | none | Return a range at the index n |