diff --git a/src/json.cc b/src/json.cc index 1532ecde..0b86a148 100644 --- a/src/json.cc +++ b/src/json.cc @@ -47,7 +47,7 @@ Construct an empty JSON given the type. @post Memory for array, object, and string are allocated. */ -json::json(const value_type t) noexcept +json::json(const value_type t) : type_(t) { switch (type_) @@ -100,15 +100,15 @@ Construct a string JSON object. @param s a string to initialize the JSON object with */ -json::json(const std::string& s) noexcept +json::json(const std::string& s) : type_(value_type::string), value_(new string_t(s)) {} -json::json(std::string&& s) noexcept +json::json(std::string&& s) : type_(value_type::string), value_(new string_t(std::move(s))) {} -json::json(const char* s) noexcept +json::json(const char* s) : type_(value_type::string), value_(new string_t(s)) {} @@ -124,19 +124,19 @@ json::json(const double f) noexcept : type_(value_type::number_float), value_(f) {} -json::json(const array_t& a) noexcept +json::json(const array_t& a) : type_(value_type::array), value_(new array_t(a)) {} -json::json(array_t&& a) noexcept +json::json(array_t&& a) : type_(value_type::array), value_(new array_t(std::move(a))) {} -json::json(const object_t& o) noexcept +json::json(const object_t& o) : type_(value_type::object), value_(new object_t(o)) {} -json::json(object_t&& o) noexcept +json::json(object_t&& o) : type_(value_type::object), value_(new object_t(std::move(o))) {} @@ -155,7 +155,7 @@ as is to create an array. @bug With the described approach, we would fail to recognize an array whose first element is again an arrays as array. */ -json::json(list_init_t a) noexcept +json::json(list_init_t a) { // check if each element is an array with two elements whose first element // is a string @@ -189,7 +189,7 @@ A copy constructor for the JSON class. @param o the JSON object to copy */ -json::json(const json& o) noexcept +json::json(const json& o) : type_(o.type_) { switch (type_) diff --git a/src/json.h b/src/json.h index 42e8fa60..688d805b 100644 --- a/src/json.h +++ b/src/json.h @@ -112,17 +112,17 @@ class json public: /// create an object according to given type - json(const value_type) noexcept; + json(const value_type); /// create a null object json() = default; /// create a null object json(std::nullptr_t) noexcept; /// create a string object from a C++ string - json(const std::string&) noexcept; + json(const std::string&); /// create a string object from a C++ string (move) - json(std::string&&) noexcept; + json(std::string&&); /// create a string object from a C string - json(const char*) noexcept; + json(const char*); /// create a Boolean object json(const bool) noexcept; /// create a number object @@ -130,18 +130,18 @@ class json /// create a number object json(const double) noexcept; /// create an array - json(const array_t&) noexcept; + json(const array_t&); /// create an array (move) - json(array_t&&) noexcept; + json(array_t&&); /// create an object - json(const object_t&) noexcept; + json(const object_t&); /// create an object (move) - json(object_t&&) noexcept; + json(object_t&&); /// create from an initializer list (to an array or object) - json(list_init_t) noexcept; + json(list_init_t); /// copy constructor - json(const json&) noexcept; + json(const json&); /// move constructor json(json&&) noexcept;