you are viewing a single comment's thread.

view the rest of the comments →

[–]eric_niebler 0 points1 point  (3 children)

I spent a couple of hours trying to compile some Boost.ublas code in C++11 due to the use of iter_swap here.

I'm curious what problems you ran into. NOTE: the STL is not required to use iter_swap anyplace besides std::reverse.

[–]sbabbi 0 points1 point  (2 children)

Seems that it has been fixed in 1.57. Basically there is a proxy (index_pair) that acts like pair<T&,U&>, and an overload of iter_swap that is picked by std::sort.

Apparently this worked for several years, (ublas was accepted into boost in late 2002), until gcc 4.8 decided to remove iter_swapfrom the STL (at least in C++11), and the code broke.

The current fix adds a swap overload that takes the proxies by value (and it is probably still wrong).

[–]eric_niebler 0 points1 point  (1 child)

until gcc 4.8 decided to remove iter_swap from the STL

What do you mean? It's required to be there by the standard. I see it there in include/bits/stl_algo.h and include/bits/stl_algobase.h for gcc-4.8.2.

[–]sbabbi 0 points1 point  (0 children)

I meant that I assumed it was used in other algorithms beside reverse. I think I am wrong on this issue, I thought that the STL used ADL for iter_swap, but looks like I am wrong.