添加queue
This commit is contained in:
17
TinySTL/Queue.h
Normal file
17
TinySTL/Queue.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _QUEUE_H_
|
||||
#define _QUEUE_H_
|
||||
|
||||
#include "Deque.h"
|
||||
#include "Vector.h"
|
||||
|
||||
namespace TinySTL{
|
||||
//class of queue
|
||||
template<class T, class Containter = TinySTL::deque<T>>
|
||||
class queue{};
|
||||
//class of priority_queue
|
||||
template <class T, class Container = TinySTL::vector<T>,
|
||||
class Compare = TinySTL::less<typename Container::value_type>>
|
||||
class priority_queue{};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -89,9 +89,13 @@
|
||||
<ClInclude Include="Bitmap.h" />
|
||||
<ClInclude Include="CircularBuffer.h" />
|
||||
<ClInclude Include="Construct.h" />
|
||||
<ClInclude Include="Deque.h" />
|
||||
<ClInclude Include="Functional.h" />
|
||||
<ClInclude Include="Iterator.h" />
|
||||
<ClInclude Include="Profiler\Profiler.h" />
|
||||
<ClInclude Include="Queue.h" />
|
||||
<ClInclude Include="ReverseIterator.h" />
|
||||
<ClInclude Include="Stack.h" />
|
||||
<ClInclude Include="String.h" />
|
||||
<ClInclude Include="TypeTraits.h" />
|
||||
<ClInclude Include="UninitializedFunctions.h" />
|
||||
|
||||
@@ -65,5 +65,17 @@
|
||||
<ClInclude Include="Bitmap.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Stack.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Deque.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Queue.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Functional.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
@@ -11,20 +12,25 @@
|
||||
|
||||
#include <boost\circular_buffer.hpp>
|
||||
|
||||
#include "Bitmap.h"
|
||||
#include "Algorithm.h"
|
||||
#include "String.h"
|
||||
#include "Vector.h"
|
||||
#include "Profiler\Profiler.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace TinySTL::Profiler;
|
||||
|
||||
int main(){
|
||||
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;
|
||||
/*char array[] = "+C";
|
||||
TinySTL::string s("LoveC++");
|
||||
TinySTL::string str("ZXHLoveC++VeryMuch");
|
||||
cout << str.find_first_of(array, 0, str.size()) << endl;*/
|
||||
TinySTL::string name("zxh");
|
||||
//std::string name("zxh");
|
||||
|
||||
std::cout << "Please, enter your full name: ";
|
||||
TinySTL::getline(std::cin, name,'i');
|
||||
//std::getline(std::cin, name);
|
||||
std::cout << name << "\n";
|
||||
system("pause");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user