Boost logo

Ublas :

Subject: [ublas] index_pair_array and index_triple_array on gcc4.8, c++11
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2014-04-09 20:11:56

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:
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?)