MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / create

Function create

lesson6-Segmentation/json.hpp:17401–17419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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