Cleanup: use some make_shared.
authorCarl Hetherington <cth@carlh.net>
Sun, 2 Jul 2023 19:57:31 +0000 (21:57 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 2 Jul 2023 19:57:31 +0000 (21:57 +0200)
src/cxml.cc

index c2d85347d2a90cd893dc483439520b4826168989..b065b378dac00d9f870a30c9a8c5d945efc2f928 100644 (file)
 #include <boost/algorithm/string.hpp>
 #include <cstdio>
 
+
+using std::make_shared;
 using std::shared_ptr;
 using std::string;
 using std::vector;
 using boost::optional;
 
+
 cxml::Node::Node ()
        : _node (nullptr)
 {
@@ -85,7 +88,7 @@ cxml::Node::node_children () const
 
        vector<shared_ptr<cxml::Node>> n;
        for (auto i: _node->get_children()) {
-               n.push_back (shared_ptr<Node> (new Node (i)));
+               n.push_back(make_shared<Node>(i));
        }
 
        return n;
@@ -105,7 +108,7 @@ cxml::Node::node_children (string name) const
        vector<shared_ptr<cxml::Node>> n;
        for (auto i: _node->get_children()) {
                if (i->get_name() == name) {
-                       n.push_back (shared_ptr<Node> (new Node (i)));
+                       n.push_back(make_shared<Node>(i));
                }
        }