2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-21 03:22:14 +00:00

Fixed some gcc 4.8 issues in C++11 mode with index_pair and index_triple

This commit is contained in:
nasos
2014-04-09 19:47:17 -04:00
parent af2229b1b8
commit 8091141a73
2 changed files with 18 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ Version 1.1.0
index_triple_array to allow proper compilation of sparse containers
with g++>4.8 (4.7 also?) in C++11 mode.
02 Apr. 2014 Nasos Iliopoulos
* Added changelog

View File

@@ -1607,11 +1607,17 @@ namespace boost { namespace numeric { namespace ublas {
rhs = *this;
*this = tmp;
}
BOOST_UBLAS_INLINE
friend void swap(self_type& lhs, self_type& rhs) {
lhs.swap(rhs);
}
friend void swap(self_type lhs, self_type rhs) { // For gcc 4.8 and c++11
lhs.swap(rhs);
}
BOOST_UBLAS_INLINE
bool equal(const self_type& rhs) const {
return (v1_ == rhs.v1_);
@@ -1727,11 +1733,12 @@ namespace boost { namespace numeric { namespace ublas {
std::swap(lhs().data2_[i1], rhs().data2_[i2]);
}
// This refers to index_pair<>&, but [gcc4.8, C++11] can't deduce the type to correctly dispatch the swap
// Fixme: find a more elegant solution
BOOST_UBLAS_INLINE
friend void swap( typename iterator::reference lhs, typename iterator::reference rhs) { // This referes to index_pair<>&, but gcc4.8 can't deduce the type to correctly dispatch the swap
lhs.swap(rhs);
friend void iter_swap(iterator& lhs, const iterator& rhs) {
const size_type i1 = lhs.index();
const size_type i2 = rhs.index();
std::swap(lhs().data1_[i1], rhs().data1_[i2]);
std::swap(lhs().data2_[i1], rhs().data2_[i2]);
}
private:
@@ -1780,16 +1787,21 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
void swap(self_type& rhs) {
void swap(self_type& rhs) { // Fixme: Should this be deprecated?
self_type tmp(rhs);
rhs = *this;
*this = tmp;
}
BOOST_UBLAS_INLINE
friend void swap(self_type& lhs, self_type& rhs) {
lhs.swap(rhs);
}
friend void swap(self_type lhs, self_type rhs) { // For gcc 4.8 and c++11
lhs.swap(rhs);
}
BOOST_UBLAS_INLINE
bool equal(const self_type& rhs) const {
return ((v1_ == rhs.v1_) && (v2_ == rhs.v2_));
@@ -1910,13 +1922,6 @@ namespace boost { namespace numeric { namespace ublas {
std::swap(lhs().data3_[i1], rhs().data3_[i2]);
}
// This refers to index_pair<>&, but [gcc4.8, C++11] can't deduce the type to correctly dispatch the swap
// Fixme: find a more elegant solution
BOOST_UBLAS_INLINE
friend void swap( typename iterator::reference lhs, typename iterator::reference rhs) {
lhs.swap(rhs);
}
private:
size_type size_;
V1& data1_;