From 4ad7c9c1ad624fc811ad1b0c34e62657f1f59998 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 8 Jan 2021 14:13:01 +0100 Subject: [PATCH 1/1] Use return {}. --- src/cxml.cc | 12 ++++++------ src/cxml.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cxml.cc b/src/cxml.cc index c21bd19..922a3d7 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -70,7 +70,7 @@ cxml::Node::optional_node_child (string name) const if (n.size() > 1) { throw cxml::Error ("duplicate XML tag " + name); } else if (n.empty ()) { - return shared_ptr (); + return {}; } return n.front (); @@ -124,7 +124,7 @@ cxml::Node::optional_string_child (string c) const } if (nodes.empty ()) { - return optional (); + return {}; } return nodes.front()->content(); @@ -142,7 +142,7 @@ cxml::Node::optional_bool_child (string c) const { auto const s = optional_string_child (c); if (!s) { - return optional (); + return {}; } return (s.get() == "1" || s.get() == "yes" || s.get() == "True"); @@ -175,12 +175,12 @@ cxml::Node::optional_string_attribute (string name) const { auto e = dynamic_cast (_node); if (!e) { - return optional (); + return {}; } auto a = e->get_attribute (name); if (!a) { - return optional (); + return {}; } return string (a->get_value ()); @@ -198,7 +198,7 @@ cxml::Node::optional_bool_attribute (string name) const { auto s = optional_string_attribute (name); if (!s) { - return optional (); + return {}; } return (s.get() == "1" || s.get() == "yes"); diff --git a/src/cxml.h b/src/cxml.h index 4fccbae..330cbb0 100644 --- a/src/cxml.h +++ b/src/cxml.h @@ -164,7 +164,7 @@ public: { auto s = optional_string_child (c); if (!s) { - return boost::optional (); + return {}; } auto t = s.get (); -- 2.30.2