Opened 6 years ago

Last modified 6 years ago

#12374 new Bugs

doku bug boost::adaptors::sliced

Reported by: brix@… Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.61.0 Severity: Problem
Keywords: documentation Cc: joakimas@…

Description

Precondition: 0 <= n && n <= m && m < distance(rng)

must be

Precondition: 0 <= n && n <= m && m =< distance(rng)

example:

std::vector<int> vec; vec.push_back(3); auto wholeVectorSlice=boost::adaptors::slice(vec,0,vec.size()); distance(rng)==1

Otherwise it woudln't be possible to include the last element of the input range in the slice.

Change History (2)

comment:1 by Michel Morin, 6 years ago

Component: Documentationrange
Owner: changed from Matias Capeletto to Neil Groves

comment:2 by joakimas@…, 6 years ago

Cc: joakimas@… added

I noticed this too when looking at the documentation. Why shouldn't we be allowed to include the last element when slicing? I guess this might be a problem only with the documentation.

It seems like a more useful precondition would be

0 <= n && n <= m && m <= distance(rng)

In addition, the "returns" part of the text says the result is "make_range(rng, n, m)" but I fail to find any useful documentation on what "make_range" is.

For reference, I have been looking at this page: http://www.boost.org/doc/libs/1_61_0/libs/range/doc/html/range/reference/adaptors/reference/sliced.html

Note: See TracTickets for help on using tickets.