aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/rvalue_types.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/rvalue_types.cpp')
-rw-r--r--test/rvalue_types.cpp31
1 files changed, 1 insertions, 30 deletions
diff --git a/test/rvalue_types.cpp b/test/rvalue_types.cpp
index c20a32f79..2c9999ce8 100644
--- a/test/rvalue_types.cpp
+++ b/test/rvalue_types.cpp
@@ -13,41 +13,12 @@
#if EIGEN_HAS_CXX11
#include "MovableScalar.h"
#endif
+#include "SafeScalar.h"
#include <Eigen/Core>
using internal::UIntPtr;
-// A Scalar that asserts for uninitialized access.
-template<typename T>
-class SafeScalar {
- public:
- SafeScalar() : initialized_(false) {}
- SafeScalar(const SafeScalar& other) {
- *this = other;
- }
- SafeScalar& operator=(const SafeScalar& other) {
- val_ = T(other);
- initialized_ = true;
- return *this;
- }
-
- SafeScalar(T val) : val_(val), initialized_(true) {}
- SafeScalar& operator=(T val) {
- val_ = val;
- initialized_ = true;
- }
-
- operator T() const {
- VERIFY(initialized_ && "Uninitialized access.");
- return val_;
- }
-
- private:
- T val_;
- bool initialized_;
-};
-
#if EIGEN_HAS_RVALUE_REFERENCES
template <typename MatrixType>
void rvalue_copyassign(const MatrixType& m)