From 61f0376366c3909b32a4bee183977361f7b50e64 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 10 May 2015 17:30:41 +0200 Subject: [PATCH] more cleanup --- src/json.hpp | 20 +++++++++----------- src/json.hpp.re2c | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index ddb6e6dd..b357a70f 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -185,15 +185,15 @@ class basic_json number_float_t number_float; /// default constructor (for null values) - json_value() = default; + inline json_value() noexcept = default; /// constructor for booleans - json_value(boolean_t v) : boolean(v) {} + inline json_value(boolean_t v) noexcept : boolean(v) {} /// constructor for numbers (integer) - json_value(number_integer_t v) : number_integer(v) {} + inline json_value(number_integer_t v) noexcept : number_integer(v) {} /// constructor for numbers (floating-point) - json_value(number_float_t v) : number_float(v) {} + inline json_value(number_float_t v) noexcept : number_float(v) {} /// constructor for empty values of a given type - json_value(value_t t) + inline json_value(value_t t) { switch (t) { @@ -248,7 +248,7 @@ class basic_json } /// constructor for strings - json_value(const string_t& value) + inline json_value(const string_t& value) { AllocatorType alloc; string = alloc.allocate(1); @@ -256,7 +256,7 @@ class basic_json } /// constructor for objects - json_value(const object_t& value) + inline json_value(const object_t& value) { AllocatorType alloc; object = alloc.allocate(1); @@ -264,7 +264,7 @@ class basic_json } /// constructor for arrays - json_value(const array_t& value) + inline json_value(const array_t& value) { AllocatorType alloc; array = alloc.allocate(1); @@ -1187,9 +1187,7 @@ class basic_json if (m_type == value_t::null) { m_type = value_t::object; - AllocatorType alloc; - m_value.object = alloc.allocate(1); - alloc.construct(m_value.object); + m_value = value_t::object; } // at only works for objects diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 88ed552d..c10a9cc6 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -185,15 +185,15 @@ class basic_json number_float_t number_float; /// default constructor (for null values) - json_value() = default; + inline json_value() noexcept = default; /// constructor for booleans - json_value(boolean_t v) : boolean(v) {} + inline json_value(boolean_t v) noexcept : boolean(v) {} /// constructor for numbers (integer) - json_value(number_integer_t v) : number_integer(v) {} + inline json_value(number_integer_t v) noexcept : number_integer(v) {} /// constructor for numbers (floating-point) - json_value(number_float_t v) : number_float(v) {} + inline json_value(number_float_t v) noexcept : number_float(v) {} /// constructor for empty values of a given type - json_value(value_t t) + inline json_value(value_t t) { switch (t) { @@ -248,7 +248,7 @@ class basic_json } /// constructor for strings - json_value(const string_t& value) + inline json_value(const string_t& value) { AllocatorType alloc; string = alloc.allocate(1); @@ -256,7 +256,7 @@ class basic_json } /// constructor for objects - json_value(const object_t& value) + inline json_value(const object_t& value) { AllocatorType alloc; object = alloc.allocate(1); @@ -264,7 +264,7 @@ class basic_json } /// constructor for arrays - json_value(const array_t& value) + inline json_value(const array_t& value) { AllocatorType alloc; array = alloc.allocate(1); @@ -1187,9 +1187,7 @@ class basic_json if (m_type == value_t::null) { m_type = value_t::object; - AllocatorType alloc; - m_value.object = alloc.allocate(1); - alloc.construct(m_value.object); + m_value = value_t::object; } // at only works for objects