MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / create

Function create

examples/server/json.hpp:19551–19569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19549 /// @}
19550
19551 private:
19552
19553 /// helper for exception-safe object creation
19554 template<typename T, typename... Args>
19555 JSON_HEDLEY_RETURNS_NON_NULL
19556 static T* create(Args&& ... args)
19557 {
19558 AllocatorType<T> alloc;
19559 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
19560
19561 auto deleter = [&](T * obj)
19562 {
19563 AllocatorTraits::deallocate(alloc, obj, 1);
19564 };
19565 std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
19566 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
19567 JSON_ASSERT(obj != nullptr);
19568 return obj.release();
19569 }
19570
19571 ////////////////////////
19572 // JSON value storage //

Callers 15

from_jsonFunction · 0.85
get_arithmetic_valueFunction · 0.85
input_adapterFunction · 0.85
start_objectFunction · 0.85
start_arrayFunction · 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 2

getMethod · 0.80
releaseMethod · 0.80

Tested by

no test coverage detected