Commit 8890b935 authored by Mike Bogdanov's avatar Mike Bogdanov

fixed merge conflicts

parent daba1b6a
...@@ -8115,37 +8115,37 @@ class basic_json ...@@ -8115,37 +8115,37 @@ class basic_json
void destroy(value_t t) void destroy(value_t t)
{ {
switch (t) switch (t)
{ {
case value_t::object: case value_t::object:
{ {
AllocatorType<object_t> alloc; AllocatorType<object_t> alloc;
alloc.destroy(object); std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
alloc.deallocate(object, 1); std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
break; break;
} }
case value_t::array: case value_t::array:
{ {
AllocatorType<array_t> alloc; AllocatorType<array_t> alloc;
alloc.destroy(array); std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
alloc.deallocate(array, 1); std::allocator_traits<decltype(alloc)>::deallocate(alloc, array, 1);
break; break;
} }
case value_t::string: case value_t::string:
{ {
AllocatorType<string_t> alloc; AllocatorType<string_t> alloc;
alloc.destroy(string); std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
alloc.deallocate(string, 1); std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
break; break;
} }
default: default:
{ {
break; break;
} }
} }
} }
}; };
...@@ -8940,39 +8940,6 @@ class basic_json ...@@ -8940,39 +8940,6 @@ class basic_json
~basic_json() ~basic_json()
{ {
assert_invariant(); assert_invariant();
switch (m_type)
{
case value_t::object:
{
AllocatorType<object_t> alloc;
std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.object);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.object, 1);
break;
}
case value_t::array:
{
AllocatorType<array_t> alloc;
std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.array);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.array, 1);
break;
}
case value_t::string:
{
AllocatorType<string_t> alloc;
std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
break;
}
default:
{
// all other types need no specific destructor
break;
}
}
m_value.destroy(m_type); m_value.destroy(m_type);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment