add CollectionTest.cpp
This commit is contained in:
parent
bfd265e1f8
commit
ffc31f161f
@ -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)
|
||||||
|
38
CollectionTest.cpp
Normal file
38
CollectionTest.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include<hgl/type/Collection.h>
|
||||||
|
#include<iostream>
|
||||||
|
|
||||||
|
using namespace hgl;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
template<typename T> class NewList:public Collection<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
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"<<endl<<endl;
|
||||||
|
|
||||||
|
NewList<uint32> ulist;
|
||||||
|
|
||||||
|
ulist.Add(1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user