From b7bfc4292384a64a971702d30d8ad0fe677e67d0 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Sun, 22 Dec 2013 14:22:12 -0500 Subject: [PATCH] Added lower_bound and upper_bound functions to Values --- gtsam/nonlinear/Values.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gtsam/nonlinear/Values.h b/gtsam/nonlinear/Values.h index e364d1fc2..e4680c801 100644 --- a/gtsam/nonlinear/Values.h +++ b/gtsam/nonlinear/Values.h @@ -200,6 +200,18 @@ namespace gtsam { * not found. */ const_iterator find(Key j) const { return boost::make_transform_iterator(values_.find(j), &make_const_deref_pair); } + /** Find the element greater than or equal to the specified key. */ + iterator lower_bound(Key j) { return boost::make_transform_iterator(values_.lower_bound(j), &make_deref_pair); } + + /** Find the element greater than or equal to the specified key. */ + const_iterator lower_bound(Key j) const { return boost::make_transform_iterator(values_.lower_bound(j), &make_const_deref_pair); } + + /** Find the lowest-ordered element greater than the specified key. */ + iterator upper_bound(Key j) { return boost::make_transform_iterator(values_.upper_bound(j), &make_deref_pair); } + + /** Find the lowest-ordered element greater than the specified key. */ + const_iterator upper_bound(Key j) const { return boost::make_transform_iterator(values_.upper_bound(j), &make_const_deref_pair); } + /** The number of variables in this config */ size_t size() const { return values_.size(); }