[DEV] update new ememory::SharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-15 21:22:11 +02:00
parent ed9ca3fc6b
commit af2a31801d
3 changed files with 8 additions and 7 deletions

View File

@ -11,7 +11,7 @@
#include <map> #include <map>
#include <mutex> #include <mutex>
#include <memory> #include <ememory/memory.h>
namespace etk { namespace etk {
/** /**

View File

@ -88,6 +88,7 @@ def create(target, module_name):
# add dependency of the generic math library: # add dependency of the generic math library:
my_module.add_module_depend('m') my_module.add_module_depend('m')
my_module.add_module_depend('elog') my_module.add_module_depend('elog')
my_module.add_module_depend('ememory')
# add some optionnal libraries # add some optionnal libraries
my_module.add_optionnal_module_depend('minizip', ["c++", "-DETK_BUILD_MINIZIP"]) my_module.add_optionnal_module_depend('minizip', ["c++", "-DETK_BUILD_MINIZIP"])
my_module.add_optionnal_module_depend('linearmath', ["c", "-DETK_BUILD_LINEARMATH"], export=True) my_module.add_optionnal_module_depend('linearmath', ["c", "-DETK_BUILD_LINEARMATH"], export=True)

View File

@ -7,11 +7,11 @@
*/ */
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> #include <ememory/memory.h>
#undef NAME #undef NAME
#define NAME "Shared_ptr" #define NAME "Shared_ptr"
class Example : public std::enable_shared_from_this<Example> { class Example : public ememory::EnableSharedFromThis<Example> {
protected: protected:
int32_t m_id; int32_t m_id;
public: public:
@ -32,17 +32,17 @@ TEST(TestSTDSharedPtr, testBaseLocal) {
} }
TEST(TestSTDSharedPtr, testBaseShared) { TEST(TestSTDSharedPtr, testBaseShared) {
std::shared_ptr<Example> tmp = std::make_shared<Example>(); ememory::SharedPtr<Example> tmp = ememory::makeShared<Example>();
} }
TEST(TestSTDSharedPtr, testBaseSharedDouble) { TEST(TestSTDSharedPtr, testBaseSharedDouble) {
std::shared_ptr<Example> tmp = std::make_shared<Example>(); ememory::SharedPtr<Example> tmp = ememory::makeShared<Example>();
std::shared_ptr<Example> tmp2 = tmp; ememory::SharedPtr<Example> tmp2 = tmp;
} }
/* /*
TEST(TestSTDSharedPtr, testBaseSharedDirectAndShared) { TEST(TestSTDSharedPtr, testBaseSharedDirectAndShared) {
Example tmp; Example tmp;
std::shared_ptr<Example> tmp2 = std::make_shared<tmp>; ememory::SharedPtr<Example> tmp2 = ememory::makeShared<tmp>;
} }
*/ */