Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9684 closed Patches (invalid)

Add a multidimensional counting_range

Reported by: ilja.j.honkonen@… Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.55.0 Severity: Not Applicable
Keywords: multidimensional counting_range Cc:

Description

I think a multidimensional (floating point) counting_range with configurable step size would be useful, at least I have found a need for that many times. Here is a suggestion, could something like this eventually be included in boost? What modifications should I make (after switching to boost::bind)? The iterated values are evenly spaced from each other and the boundaries.

Example usage:

boost::array<double, 2> start{-4, 3}, end{4, 11};

const size_t samples_per_dim = 2;

for (const auto& i: volume_iterator(start, end, samples_per_dim)) {

print(i);

}

Output:

-2 5

2 5

-2 9

2 9

Attachments (1)

testi.cpp (4.7 KB ) - added by ilja.j.honkonen@… 9 years ago.

Download all attachments as: .zip

Change History (4)

by ilja.j.honkonen@…, 9 years ago

Attachment: testi.cpp added

comment:1 by Neil Groves, 9 years ago

Resolution: invalid
Status: newclosed

irange with step size already exists. The floating-point idea has been explicitly rejected due to difficulties providing loop variant / invariant guarantees.

comment:2 by anonymous, 9 years ago

In case someone finds this useful I've put it into a hpp file here: ttps://github.com/nasailja/pamhd/blob/master/source/volume_range.hpp

comment:3 by anonymous, 9 years ago

Couldn't get past the spam filter, the correct address starts with https...

Note: See TracTickets for help on using tickets.