MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / create

Function create

include/behaviortree_cpp/contrib/json.hpp:19675–19693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19673 /// @}
19674
19675 private:
19676
19677 /// helper for exception-safe object creation
19678 template<typename T, typename... Args>
19679 JSON_HEDLEY_RETURNS_NON_NULL
19680 static T* create(Args&& ... args)
19681 {
19682 AllocatorType<T> alloc;
19683 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
19684
19685 auto deleter = [&](T * obj)
19686 {
19687 AllocatorTraits::deallocate(alloc, obj, 1);
19688 };
19689 std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
19690 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
19691 JSON_ASSERT(obj != nullptr);
19692 return obj.release();
19693 }
19694
19695 ////////////////////////
19696 // JSON value storage //

Callers 15

BlackboardBackupFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
SwitchTestClass · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 1

getMethod · 0.45

Tested by 9

TESTFunction · 0.68
TESTFunction · 0.68
TEST_FFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68