From ab840b2a3397d79f9998484889a68ae3fe3358ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Sun, 12 Oct 2014 14:49:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0less?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Deque.h | 6 +++++- TinySTL/Functional.h | 17 +++++++++++++++++ TinySTL/Stack.h | 6 +++++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 TinySTL/Functional.h diff --git a/TinySTL/Deque.h b/TinySTL/Deque.h index b8eb065..4bc410c 100644 --- a/TinySTL/Deque.h +++ b/TinySTL/Deque.h @@ -1,7 +1,11 @@ #ifndef _DEQUE_H_ #define _DEQUE_H_ -namespace TinySTL{ +#include "Allocator.h" +namespace TinySTL{ + //class of deque + template> + class deque{}; } #endif \ No newline at end of file diff --git a/TinySTL/Functional.h b/TinySTL/Functional.h new file mode 100644 index 0000000..85a86ee --- /dev/null +++ b/TinySTL/Functional.h @@ -0,0 +1,17 @@ +#ifndef _FUNCTIONAL_H_ +#define _FUNCTIONAL_H_ + +namespace TinySTL{ + //********** [less] **************** + template + struct less{ + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + + result_type operator()(const first_argument_type& x, const second_argument_type& y){ + return x < y; + } + }; +} +#endif \ No newline at end of file diff --git a/TinySTL/Stack.h b/TinySTL/Stack.h index c26b3f3..560756a 100644 --- a/TinySTL/Stack.h +++ b/TinySTL/Stack.h @@ -1,7 +1,11 @@ #ifndef _STACK_H_ #define _STACK_H_ -namespace TinySTL{ +#include "Deque.h" +namespace TinySTL{ + //class of stack + template> + class stack{}; } #endif \ No newline at end of file