MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / create

Method create

Source/Basic/Object.h:50–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49 template <class T, class... Args>
50 static T* create(Args&&... args) {
51 static_assert(std::is_base_of<Object, T>::value, "T must be a subclass of Object");
52 T* item = new T(std::forward<Args>(args)...);
53 if (item && item->init()) {
54 item->autorelease();
55 } else if (item->getRefCount() == 0) {
56 delete item;
57 item = nullptr;
58 } else {
59 item = nullptr;
60 }
61 return item;
62 }
63
64 template <class T, class... Args>
65 static T* createNotNull(Args&&... args) {

Callers

nothing calls this directly

Calls 3

autoreleaseMethod · 0.80
initMethod · 0.45
getRefCountMethod · 0.45

Tested by

no test coverage detected