diff --git a/lang/c++/impl/CustomAttributes.cc b/lang/c++/impl/CustomAttributes.cc index 13c56a5e926..f31b557aebc 100644 --- a/lang/c++/impl/CustomAttributes.cc +++ b/lang/c++/impl/CustomAttributes.cc @@ -23,8 +23,8 @@ namespace avro { -boost::optional CustomAttributes::getAttribute(const std::string &name) const { - boost::optional result; +std::optional CustomAttributes::getAttribute(const std::string &name) const { + std::optional result; std::map::const_iterator iter = attributes_.find(name); if (iter == attributes_.end()) { diff --git a/lang/c++/include/avro/CustomAttributes.hh b/lang/c++/include/avro/CustomAttributes.hh index b4cc6fbbaf8..4b76b45a593 100644 --- a/lang/c++/include/avro/CustomAttributes.hh +++ b/lang/c++/include/avro/CustomAttributes.hh @@ -20,9 +20,9 @@ #define avro_CustomAttributes_hh__ #include "Config.hh" -#include #include #include +#include #include namespace avro { @@ -34,7 +34,7 @@ class AVRO_DECL CustomAttributes { public: // Retrieves the custom attribute json entity for that attributeName, returns an // null if the attribute doesn't exist. - boost::optional getAttribute(const std::string &name) const; + std::optional getAttribute(const std::string &name) const; // Adds a custom attribute. If the attribute already exists, throw an exception. void addAttribute(const std::string &name, const std::string &value); diff --git a/lang/c++/test/unittest.cc b/lang/c++/test/unittest.cc index 3558a0e2f89..b0cb44c5b9f 100644 --- a/lang/c++/test/unittest.cc +++ b/lang/c++/test/unittest.cc @@ -494,7 +494,7 @@ struct TestSchema { cf.addAttribute("field1", std::string("1")); BOOST_CHECK_EQUAL(std::string("1"), *cf.getAttribute("field1")); - BOOST_CHECK_EQUAL(false, cf.getAttribute("not_existing").is_initialized()); + BOOST_CHECK_EQUAL(false, cf.getAttribute("not_existing").has_value()); } void test() {