SafeScalar.h
Go to the documentation of this file.
1 
2 // A Scalar that asserts for uninitialized access.
3 template<typename T>
4 class SafeScalar {
5  public:
6  SafeScalar() : initialized_(false) {}
8  *this = other;
9  }
11  val_ = T(other);
12  initialized_ = true;
13  return *this;
14  }
15 
16  SafeScalar(T val) : val_(val), initialized_(true) {}
18  val_ = val;
19  initialized_ = true;
20  }
21 
22  operator T() const {
23  VERIFY(initialized_ && "Uninitialized access.");
24  return val_;
25  }
26 
27  private:
30 };
SafeScalar(T val)
Definition: SafeScalar.h:16
SafeScalar(const SafeScalar &other)
Definition: SafeScalar.h:7
SafeScalar()
Definition: SafeScalar.h:6
SafeScalar & operator=(T val)
Definition: SafeScalar.h:17
bool initialized_
Definition: SafeScalar.h:29
SafeScalar & operator=(const SafeScalar &other)
Definition: SafeScalar.h:10
Eigen::Triplet< double > T
#define VERIFY(a)
Definition: main.h:380


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:35