From ffc31f161fc381fba690f50c5408dbdc8e3c4c93 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sun, 7 Mar 2021 20:03:51 +0800 Subject: [PATCH] add CollectionTest.cpp --- CMakeLists.txt | 22 ++++++++++++++++++++-- CollectionTest.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 CollectionTest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ad073..39e9e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,21 @@ -add_executable(GetCpuInfo GetCpuInfo.cpp) -target_link_libraries(GetCpuInfo CMCore CMPlatform) +macro(cm_example_project project_name) + target_link_libraries(${project_name} PRIVATE CMCore CMPlatform) + + if(UNIX) + target_link_libraries(${project_name} PRIVATE dl) + endif() + + IF(WIN32) + set_debugger_directory(${project_name} ${CMAKE_CURRENT_SOURCE_DIR}) + ENDIF() + + set_property(TARGET ${project_name} PROPERTY FOLDER "CM/Examples") +endmacro() + + +add_executable(GetCpuInfo GetCpuInfo.cpp) +cm_example_project(GetCpuInfo) + +add_executable(CollectionTest CollectionTest.cpp) +cm_example_project(CollectionTest) diff --git a/CollectionTest.cpp b/CollectionTest.cpp new file mode 100644 index 0000000..a072898 --- /dev/null +++ b/CollectionTest.cpp @@ -0,0 +1,38 @@ +#include +#include + +using namespace hgl; +using namespace std; + +template class NewList:public Collection +{ + +public: + + NewList(MemoryBlock *amb=new MemoryBlock(new MemoryAllocator)):Collection(amb) + { + } + + virtual ~NewList()=default; + + +};// + +void main(int,char **) +{ + { + MemoryAllocator *ma=new MemoryAllocator; + + ma->Alloc(1024); + + MemoryBlock mb(ma); + } + + { + cout<<"Collection"< ulist; + + ulist.Add(1); + } +}