boost solution for transforming stl algorithms on proxy iterators?

Hi,
I often have problems which look a bit like this:
//example code, only for problem statement
//std::vector<bool> chosen only because it is no container :). If
this is too silly for you,
//think about a matrix interpreted as range of row-vectors.
std::vector<bool> myContainer;//does only have proxy iterators.
std::vector<double> myDistances; //stores for every element in
myContainer a distance
//now i want to to sort the elements of both ranges in place
//as if they were in a hypothetic range std::vector

On Tue, Oct 16, 2012 at 3:25 AM, Oswin Krause < Oswin.Krause@ruhr-uni-bochum.de> wrote:
You should be able to equally well use zip_iterator's, or, if supported by Boost.Range, something like a make_zip_range.
Ugh, yes :( This issue is AFAIK resolved with C++11 but some of us still need to
support C++03 - and I am really annoyed by this problem.
Hmmm...how is this resolved in C++11? AFAIK, C++11 still uses the old archaic iterator categories and requires a real C++ reference as the reference type of forward iterators. The thing is: this will compile on most compilers. One could just lie about
I agree, this is a deficiency in the standard. Unfortunately, maybe the only thing you can do to guarantee this works in a portable way is to code up your own introsort [1] implementation :/ - Jeff [1] http://en.wikipedia.org/wiki/Introsort

On Tue, Oct 16, 2012 at 11:08 PM, Oswin Krause < Oswin.Krause@ruhr-uni-bochum.de> wrote: [...]
would there be a general interest in a boost.iterator conforming implementation of stl algorithms?
I think any STL-like algorithms should be added to Boost.Range's existing collection of algorithms. I've personally found range interfaces to such algorithms (when appropriate) are significantly more convenient and easier to read. It's possible, for example, that a given algorithm can use the one in the STL when the iterators are conforming standard iterators or when Boost detects the underlying STL implementation relaxes the standard requirements on iterators (e.g., does not actually require the reference type to be a real reference); and otherwise dispatch to a Boost-provided implementation. Perhaps the present Boost.Range maintainer (Neil Groves, I believe?) can comment. - Jeff

Hi,
yes, this was indeed my idea.
it should be quite easy to check whether the class is an "old-style
iterator" or "new style iterator" and call the standard implementation
if this is applicable. I would branch using
is_same<
remove_const
(i.e. underlying type of X::reference is X::value_type) In my opinion, this would give real value to boost.range aside from the smarter interface :) On 2012-10-17 13:33, Jeffrey Lee Hellrung, Jr. wrote:

Dear all, I have a simple Jamroot file for which I don't know why it does not work. Bjam is always complaining: error: Unable to find file or target named error: '/boost/filesystem//fs' error: referred from project at error: '.' However, since I use "use-project boost : c:/boost_1_50_0 ; ", I would assume that it would find it easily. Here is the Jamroot: using msvc ; use-project boost : c:/boost_1_50_0 ; project spectraImport : requirements <library>/boost/filesystem//fs : build-dir ../boost-build ; exe spectraImport : [ glob *.cpp ] ; install ../boost-build : spectraImport ; I appriciate any help. Thank you, Ronny

AMDG On 10/17/2012 05:13 AM, Ronny Herzog wrote:
It would find it if you used the correct name: /boost/filesystem//boost_filesystem or, /boost//filesystem In Christ, Steven Watanabe P.S. Please don't reply to an existing thread with a new subject. Start a new thread instead.

This issue is AFAIK resolved with C++11 but some of us still need to support C++03 - and I am really annoyed by this problem.
Hmmm...how is this resolved in C++11? AFAIK, C++11 still uses the old archaic iterator categories and requires a real C++ reference as the reference type of forward iterators.
C++ requires it to be `iterator_traits<Iterator>::reference`, I thought, or does it require it to be real reference like `iterator_traits<Iterator>::value_type&`?

Hi,
The first is a requirement for every iterator. However, there are a few more lines written in pure standardese which are described in the boost.iterator docu: http://www.boost.org/doc/libs/1_51_0/libs/iterator/doc/new-iter-concepts.htm... "Value Access Requirements in Existing Iterator Categories: [..] Forward Iterator *i is T&" where T is the value_type of the iterator. Greetings, Oswin
participants (5)
-
Jeffrey Lee Hellrung, Jr.
-
Oswin Krause
-
paul Fultz
-
Ronny Herzog
-
Steven Watanabe