MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / create

Function create

3rd/nlohmann_json/single_include/nlohmann/json.hpp:18425–18443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18423 /// @}
18424
18425 private:
18426
18427 /// helper for exception-safe object creation
18428 template<typename T, typename... Args>
18429 JSON_HEDLEY_RETURNS_NON_NULL
18430 static T* create(Args&& ... args)
18431 {
18432 AllocatorType<T> alloc;
18433 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
18434
18435 auto deleter = [&](T * obj)
18436 {
18437 AllocatorTraits::deallocate(alloc, obj, 1);
18438 };
18439 std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
18440 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
18441 JSON_ASSERT(obj != nullptr);
18442 return obj.release();
18443 }
18444
18445 ////////////////////////
18446 // JSON value storage //

Callers 15

from_jsonFunction · 0.70
get_arithmetic_valueFunction · 0.70
input_adapterFunction · 0.70
start_objectMethod · 0.70
start_arrayMethod · 0.70
start_objectMethod · 0.70
start_arrayMethod · 0.70
binary_readerClass · 0.70
get_bson_stringMethod · 0.70
get_bson_binaryMethod · 0.70
parse_cbor_internalMethod · 0.70

Calls 4

deallocateFunction · 0.50
allocateFunction · 0.50
getMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected