diff --git a/CMakeLists.txt b/CMakeLists.txt index bbed65f..c8e9f33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,6 @@ cm_example_project("DataType" StrChrTest) add_executable(Uint2StrTest datatype/utos_test.cpp) cm_example_project("DataType" Uint2StrTest) -add_executable(MapTest datatype/MapTest.cpp) -cm_example_project("DataType" MapTest) - -add_executable(MultiMapTest datatype/MultiMapTest.cpp) -cm_example_project("DataType" MultiMapTest) - add_executable(RuntimeAssetManagerTest datatype/ram/RuntimeAssetManagerTest.cpp datatype/ram/RuntimeAssetManager.h datatype/ram/RAM_TestClass.h @@ -70,6 +64,9 @@ set_property(TARGET QueueTest PROPERTY FOLDER "CM/Examples/DataType/DataArray") add_executable(PoolTest datatype/PoolTest.cpp) set_property(TARGET PoolTest PROPERTY FOLDER "CM/Examples/DataType/DataArray") +add_executable(MapTest datatype/MapTest.cpp) +set_property(TARGET MapTest PROPERTY FOLDER "CM/Examples/DataType/DataArray") + #################################################################################################### add_executable(FixFilenameTest filesystem/FixFilenameTest.cpp) diff --git a/datatype/MapTest.cpp b/datatype/MapTest.cpp index 973702a..ba7a81f 100644 --- a/datatype/MapTest.cpp +++ b/datatype/MapTest.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include"UserInfo.h" using namespace hgl; using namespace std; @@ -23,7 +25,7 @@ void out_id(Map &int_map) // } //lambda用法 - int_map.Enum([](const int &key,int value) + int_map.Enum([](const int &key,int &value) { cout<<"["< &int_map) cout< int_sets; @@ -40,11 +44,11 @@ int main(int,char **) srand(time(nullptr)); - for(int i=0;i<20;i++) + for(int i=0;i ui_map; + + for(auto &ui:user_info_array) + ui_map.Add(ui.name,ui); + + ui_map.Enum([](const UTF8String &key,UserInfo &ui) + { + cout<<"["< ui_queue; - for(uint i=0;i ui_queue; - for(uint i=0;i