Skip to content

Commit

Permalink
fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
bogemic committed Dec 6, 2017
1 parent daba1b6 commit 8890b93
Showing 1 changed file with 31 additions and 64 deletions.
95 changes: 31 additions & 64 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8115,37 +8115,37 @@ class basic_json

void destroy(value_t t)
{
switch (t)
{
case value_t::object:
{
AllocatorType<object_t> alloc;
alloc.destroy(object);
alloc.deallocate(object, 1);
break;
}

case value_t::array:
{
AllocatorType<array_t> alloc;
alloc.destroy(array);
alloc.deallocate(array, 1);
break;
}

case value_t::string:
{
AllocatorType<string_t> alloc;
alloc.destroy(string);
alloc.deallocate(string, 1);
break;
}

default:
{
break;
}
}
switch (t)
{
case value_t::object:
{
AllocatorType<object_t> alloc;
std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
break;
}

case value_t::array:
{
AllocatorType<array_t> alloc;
std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, array, 1);
break;
}

case value_t::string:
{
AllocatorType<string_t> alloc;
std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
break;
}

default:
{
break;
}
}
}
};

Expand Down Expand Up @@ -8940,39 +8940,6 @@ class basic_json
~basic_json()
{
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);
}

Expand Down

0 comments on commit 8890b93

Please sign in to comment.