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

Function create

3rd/nlohmann_json/include/nlohmann/json.hpp:924–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

922 /// @}
923
924 private:
925
926 /// helper for exception-safe object creation
927 template<typename T, typename... Args>
928 JSON_HEDLEY_RETURNS_NON_NULL
929 static T* create(Args&& ... args)
930 {
931 AllocatorType<T> alloc;
932 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
933
934 auto deleter = [&](T * obj)
935 {
936 AllocatorTraits::deallocate(alloc, obj, 1);
937 };
938 std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
939 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
940 JSON_ASSERT(obj != nullptr);
941 return obj.release();
942 }
943
944 ////////////////////////
945 // JSON value storage //

Callers 15

json_valueFunction · 0.70
basic_jsonFunction · 0.70
json.hppFile · 0.70
get_ref_implFunction · 0.70
JSON_CATCHFunction · 0.70
operator[]Function · 0.70
valueFunction · 0.70
eraseFunction · 0.70
push_backFunction · 0.70
emplace_backFunction · 0.70
emplaceFunction · 0.70
insertFunction · 0.70

Calls 4

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

Tested by 2

WaitMethod · 0.40
AssumeRoleMethod · 0.40