MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / create

Function create

src/include/nlohmann/json.hpp:376–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374 /// @}
375
376 private:
377
378 /// helper for exception-safe object creation
379 template<typename T, typename... Args>
380 JSON_HEDLEY_RETURNS_NON_NULL
381 static T* create(Args&& ... args)
382 {
383 AllocatorType<T> alloc;
384 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
385
386 auto deleter = [&](T * obj)
387 {
388 AllocatorTraits::deallocate(alloc, obj, 1);
389 };
390 std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
391 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
392 JSON_ASSERT(obj != nullptr);
393 return obj.release();
394 }
395
396 ////////////////////////
397 // JSON value storage //

Callers 15

json_valueFunction · 0.85
basic_jsonFunction · 0.85
json.hppFile · 0.85
get_ref_implFunction · 0.85
JSON_CATCHFunction · 0.85
atFunction · 0.85
operator[]Function · 0.85
valueFunction · 0.85
eraseFunction · 0.85
erase_internalFunction · 0.85
push_backFunction · 0.85
emplace_backFunction · 0.85

Calls 2

releaseMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected