aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-06-03 14:28:25 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-06-03 14:28:25 +0200
commit8d97ba6b2251aabf325ff74f24959ceaa85cf11e (patch)
tree0bd426a49b729fa2a9260bad8cab750cc39587d4 /Eigen/src
parente8b922ca631b47e9a1044454402ff0ed5e77e18c (diff)
bug #725: make move ctor/assignment noexcept.
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/DenseStorage.h12
-rw-r--r--Eigen/src/Core/Matrix.h4
-rw-r--r--Eigen/src/Core/PlainObjectBase.h4
-rw-r--r--Eigen/src/Core/util/Macros.h9
4 files changed, 18 insertions, 11 deletions
diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h
index 50f0af356..82201d96a 100644
--- a/Eigen/src/Core/DenseStorage.h
+++ b/Eigen/src/Core/DenseStorage.h
@@ -364,7 +364,7 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
}
#if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC
- DenseStorage(DenseStorage&& other)
+ DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
: m_data(std::move(other.m_data))
, m_rows(std::move(other.m_rows))
, m_cols(std::move(other.m_cols))
@@ -374,7 +374,7 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
other.m_cols = 0;
}
EIGEN_DEVICE_FUNC
- DenseStorage& operator=(DenseStorage&& other)
+ DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
{
using std::swap;
swap(m_data, other.m_data);
@@ -443,7 +443,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
}
#if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC
- DenseStorage(DenseStorage&& other)
+ DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
: m_data(std::move(other.m_data))
, m_cols(std::move(other.m_cols))
{
@@ -451,7 +451,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
other.m_cols = 0;
}
EIGEN_DEVICE_FUNC
- DenseStorage& operator=(DenseStorage&& other)
+ DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
{
using std::swap;
swap(m_data, other.m_data);
@@ -516,7 +516,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
}
#if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC
- DenseStorage(DenseStorage&& other)
+ DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
: m_data(std::move(other.m_data))
, m_rows(std::move(other.m_rows))
{
@@ -524,7 +524,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
other.m_rows = 0;
}
EIGEN_DEVICE_FUNC
- DenseStorage& operator=(DenseStorage&& other)
+ DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
{
using std::swap;
swap(m_data, other.m_data);
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h
index 86fce9571..502b7935a 100644
--- a/Eigen/src/Core/Matrix.h
+++ b/Eigen/src/Core/Matrix.h
@@ -270,7 +270,7 @@ class Matrix
#if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC
- Matrix(Matrix&& other)
+ Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
: Base(std::move(other))
{
Base::_check_template_params();
@@ -278,7 +278,7 @@ class Matrix
Base::_set_noalias(other);
}
EIGEN_DEVICE_FUNC
- Matrix& operator=(Matrix&& other)
+ Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
{
other.swap(*this);
return *this;
diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h
index 8dc24c239..570dbd53b 100644
--- a/Eigen/src/Core/PlainObjectBase.h
+++ b/Eigen/src/Core/PlainObjectBase.h
@@ -494,13 +494,13 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
#if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC
- PlainObjectBase(PlainObjectBase&& other)
+ PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT
: m_storage( std::move(other.m_storage) )
{
}
EIGEN_DEVICE_FUNC
- PlainObjectBase& operator=(PlainObjectBase&& other)
+ PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT
{
using std::swap;
swap(m_storage, other.m_storage);
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index 2d2d30cd2..c9a0b9893 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -437,7 +437,8 @@
// Does the compiler support C++11 noexcept?
#ifndef EIGEN_HAS_CXX11_NOEXCEPT
#if EIGEN_MAX_CPP_VER>=11 && \
- ((__cplusplus > 201103L) \
+ (__has_feature(cxx_noexcept) \
+ || (__cplusplus > 201103L) \
|| ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \
|| EIGEN_COMP_MSVC >= 1900)
#define EIGEN_HAS_CXX11_NOEXCEPT 1
@@ -911,10 +912,16 @@ namespace Eigen {
# define EIGEN_CATCH(X) else
#endif
+
#if EIGEN_HAS_CXX11_NOEXCEPT
+# define EIGEN_INCLUDE_TYPE_TRAITS
+# define EIGEN_NOEXCEPT noexcept
+# define EIGEN_NOEXCEPT_IF(x) noexcept(x)
# define EIGEN_NO_THROW noexcept(true)
# define EIGEN_EXCEPTION_SPEC(X) noexcept(false)
#else
+# define EIGEN_NOEXCEPT
+# define EIGEN_NOEXCEPT_IF(x)
# define EIGEN_NO_THROW throw()
# define EIGEN_EXCEPTION_SPEC(X) throw(X)
#endif