A simple Range class for int with c++ range-based for statement supported. (or c++ foreach statement) (aka. minimal code to support c++ foreach/range-based-for)
As we know from this example, to support range-based for we need:
- container/custom-class has
begin()
end()
method, which return a iterator or something else. - iterator has implemented operators:
- not-equal operator !=, which is
bool operator !=(T&)
- pre-increment operator ++, which is
T operator ++()