index_pair_array and index_triple_array on gcc4.8, c++11

Nasos Iliopoulos <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <[email protected]>
Hello all,

it seems the index_ pair and triple _array classes are giving trouble 
again with gcc 4.8 and c++11 mode enabled. The behavior is triggered for 
example by running the tests with:
b2 cxxflags="-std=c++11"

The problem emanates because of the new std::iter_swap implementation as 
suggested by the standard and contains calls of  swap( *a, *b).

Unfortunately the reference types in index_pair_array and 
index_triple_array are actually the respective value types themselves 
and this makes gcc not able to deduce the type, i.e. the swap operations 
excepts a reference but it finds a value. It seems that config.hpp 
contains partial specializations that could allow it to work but since 
this is not allowed by the standard (this was loosely active in 
compilers in the past?) it seems that it is not working anymore.

So I added some overloads that explicitly specialize the respective swap 
operations. The new code ( lines 1616 and 1801) can be seen here: 
https://github.com/uBLAS/ublas/blob/bugfix/ublas00002_cpp11_fixes/include/boost/numeric/ublas/storage.hpp
I think that a more permanent solution would be to re-implement the 
relative classes, but I think the changes suffice. Please let me know if 
there are any objections with the proposed solution.

Gunter: Could you provide with some insight of the certain swap behavior 
(i.e. why perform the assignment of the values upon destruction and not 
when swap is called?)

-Nasos
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.