From 995e7a511f18f6c82277fcd226f51a84e673dee7 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 16 Dec 2021 12:30:52 -0500 Subject: [PATCH] add default constructor for DiscreteKeys and minor improvements --- gtsam/discrete/DiscreteKey.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gtsam/discrete/DiscreteKey.h b/gtsam/discrete/DiscreteKey.h index f829e4f7c..3462166f4 100644 --- a/gtsam/discrete/DiscreteKey.h +++ b/gtsam/discrete/DiscreteKey.h @@ -31,7 +31,7 @@ namespace gtsam { * Key type for discrete conditionals * Includes name and cardinality */ - typedef std::pair DiscreteKey; + using DiscreteKey = std::pair; /// DiscreteKeys is a set of keys that can be assembled using the & operator struct DiscreteKeys: public std::vector { @@ -39,13 +39,16 @@ namespace gtsam { // Forward all constructors. using std::vector::vector; + /// Constructor for serialization + GTSAM_EXPORT DiscreteKeys() : std::vector::vector() {} + /// Construct from a key - DiscreteKeys(const DiscreteKey& key) { + GTSAM_EXPORT DiscreteKeys(const DiscreteKey& key) { push_back(key); } /// Construct from a vector of keys - DiscreteKeys(const std::vector& keys) : + GTSAM_EXPORT DiscreteKeys(const std::vector& keys) : std::vector(keys) { }