Make Values::at return as const
parent
70b04afaa3
commit
32070b013f
|
|
@ -339,13 +339,12 @@ namespace gtsam {
|
|||
|
||||
/* ************************************************************************* */
|
||||
template <typename ValueType>
|
||||
ValueType Values::at(Key j) const {
|
||||
const ValueType Values::at(Key j) const {
|
||||
// Find the item
|
||||
KeyValueMap::const_iterator item = values_.find(j);
|
||||
|
||||
// Throw exception if it does not exist
|
||||
if(item == values_.end())
|
||||
throw ValuesKeyDoesNotExist("at", j);
|
||||
if (item == values_.end()) throw ValuesKeyDoesNotExist("at", j);
|
||||
|
||||
// Check the type and throw exception if incorrect
|
||||
// h() split in two lines to avoid internal compiler error (MSVC2017)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ namespace gtsam {
|
|||
* @return The stored value
|
||||
*/
|
||||
template <typename ValueType>
|
||||
ValueType at(Key j) const;
|
||||
const ValueType at(Key j) const;
|
||||
|
||||
/// version for double
|
||||
double atDouble(size_t key) const { return at<double>(key);}
|
||||
|
|
|
|||
Loading…
Reference in New Issue