From e4e8ed3898fc092ac57871e34bc5440501c796ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 8 Oct 2014 21:35:55 +0800 Subject: [PATCH 1/4] Update README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 239c75b..3fd1dcf 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,22 @@ 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) - + 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; + } +题目:利用bitmap找出str中未出现的字母 +输出结果: + + 111111111111110111111111111000000 + 32 + 字母o没出现!!! From 9a068bb65d5ef0728ff60f1e92c14a0b1ae39ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 8 Oct 2014 21:37:19 +0800 Subject: [PATCH 2/4] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3fd1dcf..c338881 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(); From 927c54bbdac6ca6f6629ccb160dd2f8c72b6852c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 8 Oct 2014 21:38:16 +0800 Subject: [PATCH 3/4] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c338881..6e9d927 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ TinySTL #TinySTL测试: ###测试环境:Windows 7 && VS2013 && release模式 ###测试结果: -####(1) +####(1): //std::vector vec; TinySTL::vector vec; @@ -58,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(); @@ -71,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(); @@ -83,6 +87,8 @@ 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): + std::string str("abcdefghijklmnpqrstuvwxyz"); TinySTL::bitmap<26> bm; for (auto it = str.cbegin(); it != str.cend(); ++it){ From 4d0651eb5469ba8de2ed90aba13f5260f0c94544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 8 Oct 2014 21:38:49 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e9d927..4da9196 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ 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): +####(4):题目:利用bitmap找出str中未出现的字母 std::string str("abcdefghijklmnpqrstuvwxyz"); TinySTL::bitmap<26> bm; @@ -100,7 +100,6 @@ TinySTL if (!bm.test(i)) cout << "字母" << (char)('a' + i) << "没出现!!!" << endl; } -题目:利用bitmap找出str中未出现的字母 输出结果: 111111111111110111111111111000000