Skip to content

Commit

Permalink
🚨 remove C4996 warnings #872
Browse files Browse the repository at this point in the history
These were the remaining direct calls to alloc.
  • Loading branch information
nlohmann committed Dec 13, 2017
1 parent f7ae143 commit a9a4ff6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8028,7 +8028,6 @@ class basic_json
static T* create(Args&& ... args)
{
AllocatorType<T> alloc;

using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;

auto deleter = [&](T * object)
Expand Down Expand Up @@ -10719,8 +10718,8 @@ class basic_json
if (is_string())
{
AllocatorType<string_t> alloc;
alloc.destroy(m_value.string);
alloc.deallocate(m_value.string, 1);
std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
m_value.string = nullptr;
}

Expand Down Expand Up @@ -10825,8 +10824,8 @@ class basic_json
if (is_string())
{
AllocatorType<string_t> alloc;
alloc.destroy(m_value.string);
alloc.deallocate(m_value.string, 1);
std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
m_value.string = nullptr;
}

Expand Down

0 comments on commit a9a4ff6

Please sign in to comment.