diff --git a/BaseLib/ConfigTreeNew.cpp b/BaseLib/ConfigTreeNew.cpp index 99da9177fb7901b90ce1d2dbff1d25a10a028724..24b807d883c34582a7c6fa84dfd270b0bdf08bfa 100644 --- a/BaseLib/ConfigTreeNew.cpp +++ b/BaseLib/ConfigTreeNew.cpp @@ -94,9 +94,8 @@ getConfSubtreeOptional(std::string const& root) if (subtree) { markVisited(root); - boost::optional<ConfigTreeNew> t; - t.emplace(*subtree, *this, root); - return std::move(t); + return boost::optional<ConfigTreeNew>(std::move( + ConfigTreeNew(*subtree, *this, root))); } else { markVisited(root, true); return boost::optional<ConfigTreeNew>(); diff --git a/BaseLib/ConfigTreeNew.h b/BaseLib/ConfigTreeNew.h index 4c5dc68f9a9ce0bfc423c65d03cc8e0d05cce3db..ea660c36d7b9291cee14d8ee21c62c113a3099e5 100644 --- a/BaseLib/ConfigTreeNew.h +++ b/BaseLib/ConfigTreeNew.h @@ -170,8 +170,8 @@ public: /*! Creates a new instance wrapping the given Boost Property Tree. * * \param tree the Boost Property Tree to be wrapped - * \param onerror callback function to be called on error. - * \param onwarning callback function to be called on warning. + * \param error_cb callback function to be called on error. + * \param warning_cb callback function to be called on warning. * * The callback functions must be valid callable functions, i.e. not nullptr's. * They are configurable in order to make unit tests of this class easier. @@ -185,9 +185,6 @@ public: Callback const& error_cb = onerror, Callback const& warning_cb = onwarning); - //! Used for wrapping a subtree - explicit ConfigTreeNew(PTree const& tree, ConfigTreeNew const& parent, std::string const& root); - //! copying is not compatible with the semantics of this class ConfigTreeNew(ConfigTreeNew const&) = delete; @@ -314,6 +311,9 @@ private: std::type_index type; }; + //! Used for wrapping a subtree + explicit ConfigTreeNew(PTree const& tree, ConfigTreeNew const& parent, std::string const& root); + //! Called if an error occurs. Will call the error callback. //! This method only acts as a helper method. void error(std::string const& message);