#4620 closed Patches (fixed)
Range Adaptor: enumerate(d)
Reported by: | 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)
Change History (7)
by , 12 years ago
Attachment: | enumerate.h added |
---|
comment:1 by , 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 , 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 , 8 years ago
Milestone: | To Be Determined → Boost 1.56.0 |
---|---|
Status: | new → assigned |
The new indexed adaptor is committed to the develop branch. Once the regression tests successfully cycle I shall promote to the master branch.
comment:5 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.
enumerate.h