Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

358 lines
8.6 KiB

  1. // stl.h supplemental header
  2. #pragma once
  3. #ifndef _STL_H_
  4. #define _STL_H_
  5. #include <algorithm>
  6. #include <deque>
  7. #include <functional>
  8. #include <iterator>
  9. #include <list>
  10. #include <map>
  11. #include <memory>
  12. #include <numeric>
  13. #include <queue>
  14. #include <set>
  15. #include <stack>
  16. #include <utility>
  17. #include <vector>
  18. using namespace std;
  19. // TEMPLATE CLASS Deque
  20. template<class _Ty>
  21. class Deque
  22. : public deque<_Ty, allocator<_Ty> >
  23. { // wrap new deque as old
  24. public:
  25. typedef Deque<_Ty> _Myt;
  26. typedef allocator<_Ty> _Alloc;
  27. Deque()
  28. : deque<_Ty, _Alloc>()
  29. { // construct empty deque
  30. }
  31. explicit Deque(size_type _Count)
  32. : deque<_Ty, _Alloc>(_Count, _Ty())
  33. { // construct deque from _Count * _Ty()
  34. }
  35. Deque(size_type _Count, const _Ty& _Val)
  36. : deque<_Ty, _Alloc>(_Count, _Val)
  37. { // construct deque from _Count * _Val
  38. }
  39. typedef const_iterator _Iter;
  40. Deque(_Iter _First, _Iter _Last)
  41. : deque<_Ty, _Alloc>(_First, _Last)
  42. { // construct deque from [_First, _Last)
  43. }
  44. };
  45. // TEMPLATE CLASS List
  46. template<class _Ty>
  47. class List
  48. : public list<_Ty, allocator<_Ty> >
  49. { // wrap new list as old
  50. public:
  51. typedef List<_Ty> _Myt;
  52. typedef allocator<_Ty> _Alloc;
  53. List()
  54. : list<_Ty, _Alloc>()
  55. { // construct empty list
  56. }
  57. explicit List(size_type _Count)
  58. : list<_Ty, _Alloc>(_Count, _Ty())
  59. { // construct list from _Count * _Ty()
  60. }
  61. List(size_type _Count, const _Ty& _Val)
  62. : list<_Ty, _Alloc>(_Count, _Val)
  63. { // construct list from _Count * _Val
  64. }
  65. typedef const_iterator _Iter;
  66. List(_Iter _First, _Iter _Last)
  67. : list<_Ty, _Alloc>(_First, _Last)
  68. { // construct list from [_First, _Last)
  69. }
  70. };
  71. // TEMPLATE CLASS Map
  72. template<class _Kty,
  73. class _Ty,
  74. class _Pr = less<_Kty> >
  75. class Map
  76. : public map<_Kty, _Ty, _Pr, allocator<_Ty> >
  77. { // wrap new map as old
  78. public:
  79. typedef Map<_Kty, _Ty, _Pr> _Myt;
  80. typedef allocator<_Ty> _Alloc;
  81. Map()
  82. : map<_Kty, _Ty, _Pr, _Alloc>(_Pr())
  83. { // construct empty map from defaults
  84. }
  85. explicit Map(const _Pr& _Pred)
  86. : map<_Kty, _Ty, _Pr, _Alloc>(_Pred)
  87. { // construct empty map from comparator
  88. }
  89. typedef const_iterator _Iter;
  90. Map(_Iter _First, _Iter _Last)
  91. : map<_Kty, _Ty, _Pr, _Alloc>(_First, _Last, _Pr())
  92. { // construct map from [_First, _Last)
  93. }
  94. Map(_Iter _First, _Iter _Last, const _Pr& _Pred)
  95. : map<_Kty, _Ty, _Pr, _Alloc>(_First, _Last, _Pred)
  96. { // construct map from [_First, _Last), comparator
  97. }
  98. };
  99. // TEMPLATE CLASS Multimap
  100. template<class _Kty,
  101. class _Ty,
  102. class _Pr = less<_Kty> >
  103. class Multimap
  104. : public multimap<_Kty, _Ty, _Pr, allocator<_Ty> >
  105. { // wrap new multimap as old
  106. public:
  107. typedef Multimap<_Kty, _Ty, _Pr> _Myt;
  108. typedef allocator<_Ty> _Alloc;
  109. Multimap()
  110. : multimap<_Kty, _Ty, _Pr, _Alloc>(_Pr())
  111. { // construct empty map from defaults
  112. }
  113. explicit Multimap(const _Pr& _Pred)
  114. : multimap<_Kty, _Ty, _Pr, _Alloc>(_Pred)
  115. { // construct empty map from comparator
  116. }
  117. typedef const_iterator _Iter;
  118. Multimap(_Iter _First, _Iter _Last)
  119. : multimap<_Kty, _Ty, _Pr, _Alloc>(_First, _Last, _Pr())
  120. { // construct map from [_First, _Last)
  121. }
  122. Multimap(_Iter _First, _Iter _Last, const _Pr& _Pred)
  123. : multimap<_Kty, _Ty, _Pr, _Alloc>(_First, _Last, _Pred)
  124. { // construct map from [_First, _Last), comparator
  125. }
  126. };
  127. // TEMPLATE CLASS Set
  128. template<class _Kty,
  129. class _Pr = less<_Kty> >
  130. class Set
  131. : public set<_Kty, _Pr, allocator<_Kty> >
  132. { // wrap new set as old
  133. public:
  134. typedef Set<_Kty, _Pr> _Myt;
  135. typedef allocator<_Kty> _Alloc;
  136. Set()
  137. : set<_Kty, _Pr, _Alloc>(_Pr())
  138. { // construct empty set from defaults
  139. }
  140. explicit Set(const _Pr& _Pred)
  141. : set<_Kty, _Pr, _Alloc>(_Pred)
  142. { // construct empty set from comparator
  143. }
  144. typedef const_iterator _Iter;
  145. Set(_Iter _First, _Iter _Last)
  146. : set<_Kty, _Pr, _Alloc>(_First, _Last, _Pr())
  147. { // construct set from [_First, _Last)
  148. }
  149. Set(_Iter _First, _Iter _Last, const _Pr& _Pred)
  150. : set<_Kty, _Pr, _Alloc>(_First, _Last, _Pred)
  151. { // construct set from [_First, _Last), comparator
  152. }
  153. };
  154. // TEMPLATE CLASS Multiset
  155. template<class _Kty,
  156. class _Pr = less<_Kty> >
  157. class Multiset
  158. : public multiset<_Kty, _Pr, allocator<_Kty> >
  159. { // wrap new multiset as old
  160. public:
  161. typedef Multiset<_Kty, _Pr> _Myt;
  162. typedef allocator<_Kty> _Alloc;
  163. Multiset()
  164. : multiset<_Kty, _Pr, _Alloc>(_Pr())
  165. { // construct empty set from defaults
  166. }
  167. explicit Multiset(const _Pr& _Pred)
  168. : multiset<_Kty, _Pr, _Alloc>(_Pred)
  169. { // construct empty set from comparator
  170. }
  171. typedef const_iterator _Iter;
  172. Multiset(_Iter _First, _Iter _Last)
  173. : multiset<_Kty, _Pr, _Alloc>(_First, _Last, _Pr())
  174. { // construct set from [_First, _Last)
  175. }
  176. Multiset(_Iter _First, _Iter _Last, const _Pr& _Pred)
  177. : multiset<_Kty, _Pr, _Alloc>(_First, _Last, _Pred)
  178. { // construct set from [_First, _Last), comparator
  179. }
  180. };
  181. // TEMPLATE CLASS Vector
  182. template<class _Ty>
  183. class Vector
  184. : public vector<_Ty, allocator<_Ty> >
  185. { // wrap new vector as old
  186. public:
  187. typedef Vector<_Ty> _Myt;
  188. typedef allocator<_Ty> _Alloc;
  189. Vector()
  190. : vector<_Ty, _Alloc>()
  191. { // construct empty vector
  192. }
  193. explicit Vector(size_type _Count)
  194. : vector<_Ty, _Alloc>(_Count, _Ty())
  195. { // construct vector from _Count * _Ty()
  196. }
  197. Vector(size_type _Count, const _Ty& _Val)
  198. : vector<_Ty, _Alloc>(_Count, _Val)
  199. { // construct vector from _Count * _Val
  200. }
  201. typedef const_iterator _Iter;
  202. Vector(_Iter _First, _Iter _Last)
  203. : vector<_Ty, _Alloc>(_First, _Last)
  204. { // construct vector from [_First, _Last)
  205. }
  206. };
  207. // CLASS bit_vector
  208. class bit_vector
  209. : public vector<_Bool, _Bool_allocator>
  210. { // wrap new vector<bool> as old
  211. public:
  212. typedef _Bool _Ty;
  213. typedef _Bool_allocator _Alloc;
  214. typedef bit_vector _Myt;
  215. bit_vector()
  216. : vector<_Bool, _Bool_allocator>()
  217. { // construct empty vector
  218. }
  219. explicit bit_vector(size_type _Count, const _Ty& _Val = _Ty())
  220. : vector<_Bool, _Bool_allocator>(_Count, _Val)
  221. { // construct vector from _Count * _Val
  222. }
  223. typedef const_iterator _Iter;
  224. bit_vector(_Iter _First, _Iter _Last)
  225. : vector<_Bool, _Bool_allocator>(_First, _Last)
  226. { // construct vector from [_First, _Last)
  227. }
  228. };
  229. // TEMPLATE CLASS priority_queue
  230. template<class _Container,
  231. class _Pr = less<_Container::value_type> >
  232. class Priority_queue
  233. : public priority_queue<_Container::value_type, _Container, _Pr>
  234. { // wrap new priority_queue as old
  235. public:
  236. typedef typename _Container::value_type _Ty;
  237. Priority_queue()
  238. : priority_queue<_Ty, _Container, _Pr>(_Pr())
  239. { // construct empty queue from defaults
  240. }
  241. explicit Priority_queue(const _Pr& _Pred)
  242. : priority_queue<_Ty, _Container, _Pr>(_Pred)
  243. { // construct empty queue from comparator
  244. }
  245. typedef const _Ty *_Iter;
  246. Priority_queue(_Iter _First, _Iter _Last)
  247. : priority_queue<_Ty, _Container, _Pr>(_First, _Last, _Pr())
  248. { // construct queue from [_First, _Last)
  249. }
  250. Priority_queue(_Iter _First, _Iter _Last, const _Pr& _Pred)
  251. : priority_queue<_Ty, _Container, _Pr>(_First, _Last, _Pred)
  252. { // construct map from [_First, _Last), comparator
  253. }
  254. };
  255. // TEMPLATE CLASS queue
  256. template<class _Container>
  257. class Queue
  258. : public queue<_Container::value_type, _Container>
  259. { // wrap new queue as old
  260. };
  261. // TEMPLATE CLASS stack
  262. template<class _Container>
  263. class Stack
  264. : public stack<_Container::value_type, _Container>
  265. { // wrap new stack as old
  266. };
  267. // MACRO DEFINITIONS
  268. #define deque Deque
  269. #define list List
  270. #define map Map
  271. #define multimap Multimap
  272. #define set Set
  273. #define multiset Multiset
  274. #define vector Vector
  275. #define priority_queue Priority_queue
  276. #define queue Queue
  277. #define stack Stack
  278. #endif /* _STL_H_ */
  279. /*
  280. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  281. * Consult your license regarding permissions and restrictions.
  282. */
  283. /*
  284. * This file is derived from software bearing the following
  285. * restrictions:
  286. *
  287. * Copyright (c) 1994
  288. * Hewlett-Packard Company
  289. *
  290. * Permission to use, copy, modify, distribute and sell this
  291. * software and its documentation for any purpose is hereby
  292. * granted without fee, provided that the above copyright notice
  293. * appear in all copies and that both that copyright notice and
  294. * this permission notice appear in supporting documentation.
  295. * Hewlett-Packard Company makes no representations about the
  296. * suitability of this software for any purpose. It is provided
  297. * "as is" without express or implied warranty.
  298. V3.10:0009 */