提交 d8d5edb3 编写于 作者: M Megvii Engine Team

refactor(opdef): overwrite shared_from_this to avoid const_cast

GitOrigin-RevId: 5322dbbb3ff5b89f8b3615559db01aa48f66d834
上级 4b0ecb5d
...@@ -102,6 +102,11 @@ public: ...@@ -102,6 +102,11 @@ public:
static void set_allocator(allocator_t allocator); static void set_allocator(allocator_t allocator);
DeviceTensorStorage::RawStorage allocate(CompNode, size_t) const; DeviceTensorStorage::RawStorage allocate(CompNode, size_t) const;
std::shared_ptr<OpDef> shared_from_this() const {
return const_cast<OpDef&>(*this)
.std::enable_shared_from_this<OpDef>::shared_from_this();
}
}; };
template <typename T> template <typename T>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册