MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / create

Function create

Source/Utils/json.hpp:17400–17418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17398 /// @}
17399
17400 private:
17401
17402 /// helper for exception-safe object creation
17403 template<typename T, typename... Args>
17404 JSON_HEDLEY_RETURNS_NON_NULL
17405 static T* create(Args&& ... args)
17406 {
17407 AllocatorType<T> alloc;
17408 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
17409
17410 auto deleter = [&](T* object)
17411 {
17412 AllocatorTraits::deallocate(alloc, object, 1);
17413 };
17414 std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);
17415 AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);
17416 JSON_ASSERT(object != nullptr);
17417 return object.release();
17418 }
17419
17420 ////////////////////////
17421 // JSON value storage //

Callers 15

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

Calls 1

getMethod · 0.45

Tested by

no test coverage detected