完成bitmap

This commit is contained in:
邹晓航
2014-10-08 21:26:24 +08:00
parent 206e98126d
commit ec4df1c48e
2 changed files with 9 additions and 9 deletions

View File

@@ -22,7 +22,6 @@ namespace TinySTL{
enum EAlign{ ALIGN = 8 }; enum EAlign{ ALIGN = 8 };
public: public:
bitmap(); bitmap();
explicit bitmap(const std::string& str);//TODO
//Returns the number of bits in the bitset that are set (i.e., that have a value of one) //Returns the number of bits in the bitset that are set (i.e., that have a value of one)
size_t count() const; size_t count() const;

View File

@@ -1,29 +1,30 @@
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <list> #include <list>
#include <mutex>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <iterator> #include <iterator>
#include <thread>
#include <utility> #include <utility>
#include <boost\circular_buffer.hpp> #include <boost\circular_buffer.hpp>
#include "CircularBuffer.h" #include "Bitmap.h"
#include "Profiler\Profiler.h" #include "Profiler\Profiler.h"
using namespace std; using namespace std;
using namespace TinySTL::Profiler; using namespace TinySTL::Profiler;
int main(){ int main(){
TinySTL::circular_buffer<int, 10000> cb(10000, 0); std::string str("abcdefghijklmnpqrstuvwxyz");
//boost::circular_buffer<int> cb(10000, 0); TinySTL::bitmap<26> bm;
ProfilerInstance::start(); for (auto it = str.cbegin(); it != str.cend(); ++it){
for (int i = 0; i != 100; ++i){ bm.set(*it - 'a');
cb.push_back(i);
} }
ProfilerInstance::finish(); cout << bm << endl;
ProfilerInstance::dumpDuringTime(); cout << bm.size() << endl;
system("pause"); system("pause");
return 0; return 0;
} }