💄 reformatted code after PRs
This commit is contained in:
parent
c5e731774a
commit
9e2f185ac6
1 changed files with 35 additions and 35 deletions
70
src/json.hpp
70
src/json.hpp
|
@ -1353,8 +1353,8 @@ struct to_json_fn
|
||||||
"could not find to_json() method in T's namespace");
|
"could not find to_json() method in T's namespace");
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// Visual Studio does not show a stacktrace for the above assert.
|
// Visual Studio does not show a stacktrace for the above assert.
|
||||||
using decayed = uncvref_t<T>;
|
using decayed = uncvref_t<T>;
|
||||||
static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0,
|
static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0,
|
||||||
"forcing msvc stacktrace to show which T we're talking about.");
|
"forcing msvc stacktrace to show which T we're talking about.");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1386,8 +1386,8 @@ struct from_json_fn
|
||||||
static_assert(sizeof(BasicJsonType) == 0,
|
static_assert(sizeof(BasicJsonType) == 0,
|
||||||
"could not find from_json() method in T's namespace");
|
"could not find from_json() method in T's namespace");
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// Visual Studio does not show a stacktrace for the above assert.
|
// Visual Studio does not show a stacktrace for the above assert.
|
||||||
using decayed = uncvref_t<T>;
|
using decayed = uncvref_t<T>;
|
||||||
static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0,
|
static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0,
|
||||||
"forcing msvc stacktrace to show which T we're talking about.");
|
"forcing msvc stacktrace to show which T we're talking about.");
|
||||||
#endif
|
#endif
|
||||||
|
@ -7945,14 +7945,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 * object)
|
||||||
{
|
{
|
||||||
AllocatorTraits::deallocate(alloc, object, 1);
|
AllocatorTraits::deallocate(alloc, object, 1);
|
||||||
};
|
};
|
||||||
std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);
|
std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);
|
||||||
AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);
|
AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);
|
||||||
assert(object != nullptr);
|
assert(object != nullptr);
|
||||||
return object.release();
|
return object.release();
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
|
std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
|
||||||
std::allocator_traits<decltype(alloc)>::deallocate(alloc, 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;
|
||||||
std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
|
std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
|
||||||
std::allocator_traits<decltype(alloc)>::deallocate(alloc, 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;
|
||||||
std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
|
std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
|
||||||
std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
|
std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue