Added casting to value type in ValueWithDefault, allows use in 'if' statements, etc. This was needed for the previous check-in of the global debug flags. Also added code comments.
parent
7cdb9b3564
commit
21f33d337c
|
@ -54,15 +54,18 @@ namespace gtsam {
|
||||||
template<typename T, T defaultValue>
|
template<typename T, T defaultValue>
|
||||||
struct ValueWithDefault {
|
struct ValueWithDefault {
|
||||||
T value;
|
T value;
|
||||||
ValueWithDefault() :
|
|
||||||
value(defaultValue) {
|
/** Default constructor, initialize to default value supplied in template argument */
|
||||||
}
|
ValueWithDefault() : value(defaultValue) {}
|
||||||
ValueWithDefault(const T& _value) :
|
|
||||||
value(_value) {
|
/** Initialize to the given value */
|
||||||
}
|
ValueWithDefault(const T& _value) : value(_value) {}
|
||||||
T& operator*() {
|
|
||||||
return value;
|
/** Operator to access the value */
|
||||||
}
|
T& operator*() { return value; }
|
||||||
|
|
||||||
|
/** Implicit conversion allows use in if statements for bool type, etc. */
|
||||||
|
operator T() const { return value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue