Unverified Commit 45810082 authored by Niels Lohmann's avatar Niels Lohmann Committed by GitHub

Merge pull request #2536 from nlohmann/shadowing

Fix a shadowing warning
parents 2fc1f694 5cc5285f
...@@ -923,14 +923,14 @@ class basic_json ...@@ -923,14 +923,14 @@ class basic_json
AllocatorType<T> alloc; AllocatorType<T> alloc;
using AllocatorTraits = std::allocator_traits<AllocatorType<T>>; using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
auto deleter = [&](T * object) auto deleter = [&](T * obj)
{ {
AllocatorTraits::deallocate(alloc, object, 1); AllocatorTraits::deallocate(alloc, obj, 1);
}; };
std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter); std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...); AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
JSON_ASSERT(object != nullptr); JSON_ASSERT(obj != nullptr);
return object.release(); return obj.release();
} }
//////////////////////// ////////////////////////
......
...@@ -17495,14 +17495,14 @@ class basic_json ...@@ -17495,14 +17495,14 @@ class basic_json
AllocatorType<T> alloc; AllocatorType<T> alloc;
using AllocatorTraits = std::allocator_traits<AllocatorType<T>>; using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
auto deleter = [&](T * object) auto deleter = [&](T * obj)
{ {
AllocatorTraits::deallocate(alloc, object, 1); AllocatorTraits::deallocate(alloc, obj, 1);
}; };
std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter); std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...); AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
JSON_ASSERT(object != nullptr); JSON_ASSERT(obj != nullptr);
return object.release(); return obj.release();
} }
//////////////////////// ////////////////////////
......
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