Opened 12 years ago

Closed 8 years ago

Last modified 8 years ago

#4620 closed Patches (fixed)

Range Adaptor: enumerate(d)

Reported by: Ilya Murav'jov <muravev@…> Owned by: Neil Groves
Milestone: Boost 1.56.0 Component: range
Version: Boost 1.44.0 Severity: Not Applicable
Keywords: Cc:

Description

I use B.Range with B.Foreach closely and consider boost::adaptors::indexed() not so good one. I would like to use it as follows:

std::vector<T> array;
BOOST_FOREACH( boost::index_value<T&> iv, array | enumerated() )
{
   int i = iv.index();
   T&  t = iv.value();
   ...
}

I've implemented such one in my program (using indexed() as source), http://gitorious.org/bombono-dvd/bombono-dvd/blobs/master/src/mlib/range/enumerate.h and hope it will be useful for others too.

Attachments (1)

enumerate.h (6.6 KB ) - added by Ilya Murav'jov <muravev@…> 12 years ago.
enumerate.h

Download all attachments as: .zip

Change History (7)

by Ilya Murav'jov <muravev@…>, 12 years ago

Attachment: enumerate.h added

enumerate.h

comment:1 by Neil Groves, 9 years ago

I just wanted to update the ticket to explain that I am having issues when applying this patch as it was supplied with a variety of compilers and platforms. I'm going to investigate this further and produce a solution. It is however taking a lot longer than I would expect a simple patch application to take since it requires some development work and obviously documentation.

I am having to reconsider my previous work. I am honestly wrestling with the idea that perhaps I should deprecate the old interface. I am also considering if this should be implemented in terms of other new work.

I apologise for the delay. For the early delay this was simply due to me not having time to dedicate to Boost. This further delay, while other tickets have been addressed, is due to the issues outlined above.

comment:2 by Neil Groves, 8 years ago

I have got an implementation of the enumerated adaptor implemented and working on many compilers and platforms with a similar interface to the one suggested by Ilya.

I believe that having indexed and enumerated would create significant confusion. The indexed adaptor has not been taken up much since my design decision to put the index into the iterator was almost useless. I am therefore intending to rename my enumerated implementation to indexed and replace it. This is a very rare breaking change to Boost.Range, but one that will not affect many people due to the horrendous usability of my first design.

comment:3 by Neil Groves, 8 years ago

Milestone: To Be DeterminedBoost 1.56.0
Status: newassigned

The new indexed adaptor is committed to the develop branch. Once the regression tests successfully cycle I shall promote to the master branch.

comment:4 by Ilya Murav'jov, 8 years ago

Thanks, I'll see it.

comment:5 by Neil Groves, 8 years ago

Resolution: fixed
Status: assignedclosed

This is working fine on develop. The new version is merged to master to be released in 1.56.

Sorry for the length of time I required to get this done. This is definitely one of my poorer efforts maintaining Boost.Range. I believe I have learned to avoid some of my mistakes with this.

comment:6 by Ilya Murav'jov, 8 years ago

Ah, don't worry!

Note: See TracTickets for help on using tickets.