diff --git a/cql3/statements/property_definitions.cc b/cql3/statements/property_definitions.cc index fc45a01307..ace1d44c87 100644 --- a/cql3/statements/property_definitions.cc +++ b/cql3/statements/property_definitions.cc @@ -87,8 +87,8 @@ std::experimental::optional property_definitions::get_simple(const sstr return std::experimental::nullopt; } try { - return boost::any_cast(it->second); - } catch (const boost::bad_any_cast& e) { + return std::get(it->second); + } catch (const std::bad_variant_access& e) { throw exceptions::syntax_exception(sprint("Invalid value for property '%s'. It should be a string", name)); } } @@ -99,8 +99,8 @@ std::experimental::optional> property_definitions::ge return std::experimental::nullopt; } try { - return boost::any_cast>(it->second); - } catch (const boost::bad_any_cast& e) { + return std::get(it->second); + } catch (const std::bad_variant_access& e) { throw exceptions::syntax_exception(sprint("Invalid value for property '%s'. It should be a map.", name)); } } @@ -188,10 +188,10 @@ void property_definitions::remove_from_map_if_exists(const sstring& name, const return; } try { - auto map = boost::any_cast>(it->second); + auto map = std::get(it->second); map.erase(key); _properties[name] = map; - } catch (const boost::bad_any_cast& e) { + } catch (const std::bad_variant_access& e) { throw exceptions::syntax_exception(sprint("Invalid value for property '%s'. It should be a map.", name)); } } diff --git a/cql3/statements/property_definitions.hh b/cql3/statements/property_definitions.hh index c99968a6db..e8f78ce6f6 100644 --- a/cql3/statements/property_definitions.hh +++ b/cql3/statements/property_definitions.hh @@ -52,19 +52,22 @@ #include #include #include - -#include +#include namespace cql3 { namespace statements { class property_definitions { +public: + using map_type = std::map; + using value_type = std::variant; protected: #if 0 protected static final Logger logger = LoggerFactory.getLogger(PropertyDefinitions.class); #endif - std::unordered_map _properties; + + std::unordered_map _properties; property_definitions(); public: