diff --git a/README.md b/README.md index 239c75b..4da9196 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ TinySTL #TinySTL测试: ###测试环境:Windows 7 && VS2013 && release模式 ###测试结果: +####(1): + //std::vector vec; TinySTL::vector vec; ProfilerInstance::start(); @@ -56,6 +58,8 @@ TinySTL ######i = 100000 -> (TinySTL::vector:2ms \\ std::vector:6ms) ######i = 1000000 -> (TinySTL::vector:11ms \\ std::vector:16ms) ######i = 10000000 -> (TinySTL::vector:129ms \\ std::vector:210ms) +####(2): + //std::vector vec; TinySTL::vector vec; ProfilerInstance::start(); @@ -69,6 +73,8 @@ TinySTL ######i = 100000 -> (TinySTL::vector:18ms \\ std::vector:29ms) ######i = 1000000 -> (TinySTL::vector:181ms \\ std::vector:232ms) ######i = 10000000 -> (TinySTL::vector:2372ms \\ std::vector:1972ms) +####(3): + TinySTL::circular_buffer cb(10000, 0); //boost::circular_buffer cb(10000, 0); ProfilerInstance::start(); @@ -81,6 +87,23 @@ TinySTL ######i = 10000000 -> (TinySTL::circular_buffer:75ms \\ boost::circular_buffer:22ms) ######i = 100000000 -> (TinySTL::circular_buffer:604ms \\ boost::circular_buffer:252ms) ######i = 1000000000 -> (TinySTL::circular_buffer:5936ms \\ boost::circular_buffer:2241ms) - +####(4):题目:利用bitmap找出str中未出现的字母 + + std::string str("abcdefghijklmnpqrstuvwxyz"); + TinySTL::bitmap<26> bm; + for (auto it = str.cbegin(); it != str.cend(); ++it){ + bm.set(*it - 'a'); + } + cout << bm << endl; + cout << bm.size() << endl; + for (int i = 0; i != 26; ++i){ + if (!bm.test(i)) + cout << "字母" << (char)('a' + i) << "没出现!!!" << endl; + } +输出结果: + + 111111111111110111111111111000000 + 32 + 字母o没出现!!!