27 const size_t& nRanges,
28 const bool& checkRanges=
false)
33 throw std::runtime_error(
"NUMBER OF RANGES MUST BE >0");
37 const auto nElments(std::distance(
first,last));
40 const size_t quotient = nElments / nRanges;
41 const size_t remainder= nElments % nRanges;
44 IterType currentBegin(
first);
45 IterType currentEnd(
first);
47 for (
size_t i=0;
i<nRanges;++
i)
49 std::advance(currentEnd,(
i<remainder)? quotient+1 : quotient);
50 this->emplace_back(currentBegin,currentEnd);
51 currentBegin=currentEnd;
57 auto temp(nElments*0);
58 for (
size_t i=0;
i<nRanges;++
i)
60 temp+=std::distance(this->
operator[](
i).
first,this->
operator[](
i).second);
62 assert(
temp==nElments);