diff --git a/gtsam/base/ThreadsafeException.h b/gtsam/base/ThreadsafeException.h index 652dbd90f..ad228e590 100644 --- a/gtsam/base/ThreadsafeException.h +++ b/gtsam/base/ThreadsafeException.h @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef GTSAM_USE_TBB #include @@ -53,7 +54,7 @@ protected: protected: bool dynamic_; ///< Whether this object was moved - mutable boost::optional description_; ///< Optional description + mutable std::optional description_; ///< Optional description /// Default constructor is protected - may only be created from derived classes ThreadsafeException() : diff --git a/gtsam/discrete/DecisionTree-inl.h b/gtsam/discrete/DecisionTree-inl.h index 9f3d5e8f9..0726da3dd 100644 --- a/gtsam/discrete/DecisionTree-inl.h +++ b/gtsam/discrete/DecisionTree-inl.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -34,6 +33,7 @@ #include #include #include +#include namespace gtsam { @@ -563,7 +563,7 @@ namespace gtsam { typename DecisionTree::NodePtr DecisionTree::compose( Iterator begin, Iterator end, const L& label) const { // find highest label among branches - boost::optional highestLabel; + std::optional highestLabel; size_t nrChoices = 0; for (Iterator it = begin; it != end; it++) { if (it->root_->isLeaf()) @@ -571,7 +571,7 @@ namespace gtsam { boost::shared_ptr c = boost::dynamic_pointer_cast(it->root_); if (!highestLabel || c->label() > *highestLabel) { - highestLabel.reset(c->label()); + highestLabel = c->label(); nrChoices = c->nrChoices(); } } diff --git a/gtsam/discrete/Signature.cpp b/gtsam/discrete/Signature.cpp index 146555898..bc045e8c2 100644 --- a/gtsam/discrete/Signature.cpp +++ b/gtsam/discrete/Signature.cpp @@ -137,14 +137,14 @@ namespace gtsam { } Signature& Signature::operator=(const string& spec) { - spec_.reset(spec); + spec_ = spec; Table table; parser::It f = spec.begin(), l = spec.end(); bool success = qi::phrase_parse(f, l, parser::grammar.table, qi::space, table); if (success) { for (Row& row : table) normalize(row); - table_.reset(table); + table_ = table; } return *this; } @@ -153,7 +153,7 @@ namespace gtsam { Table table = t; for(Row& row: table) normalize(row); - table_.reset(table); + table_ = table; return *this; } diff --git a/gtsam/discrete/Signature.h b/gtsam/discrete/Signature.h index 3138435a9..963843ab2 100644 --- a/gtsam/discrete/Signature.h +++ b/gtsam/discrete/Signature.h @@ -19,7 +19,7 @@ #pragma once #include #include -#include +#include #include namespace gtsam { @@ -68,10 +68,10 @@ namespace gtsam { DiscreteKeys parents_; // the given CPT specification string - boost::optional spec_; + std::optional spec_; // the CPT as parsed, if successful - boost::optional table_; + std::optional
table_; public: /** @@ -124,7 +124,7 @@ namespace gtsam { KeyVector indices() const; // the CPT as parsed, if successful - const boost::optional
& table() const { return table_; } + const std::optional
& table() const { return table_; } // the CPT as a vector of doubles, with key's values most rapidly changing std::vector cpt() const;