From 4c322450c6534f4bfb63403c44be46ed91a1707d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Sat, 24 Jan 2015 13:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=B9=E5=99=A8=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E5=99=A8=E7=9A=84=E7=B1=BB=E5=9E=8B=E8=90=83=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/AVLTree.h | 6 ++++-- TinySTL/BinarySearchTree.h | 6 ++++-- TinySTL/List.h | 2 +- TinySTL/TinySTL.vcxproj | 11 +++++++++-- TinySTL/TinySTL.vcxproj.filters | 21 +++++++++++++++++++++ TinySTL/Unordered_set.h | 3 ++- 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/TinySTL/AVLTree.h b/TinySTL/AVLTree.h index af1a027..d91e3a9 100644 --- a/TinySTL/AVLTree.h +++ b/TinySTL/AVLTree.h @@ -2,6 +2,7 @@ #define _AVL_TREE_H_ #include "Allocator.h" +#include "Iterator.h" #include "Stack.h" #include "String.h" @@ -83,12 +84,13 @@ namespace TinySTL{ namespace Detail{ //class of avl tree iterator template//T = node - class avl_iter{ + class avl_iter : + public iterator::value_type>{ private: template friend class avl_tree; private: - typedef typename avl_tree::value_type value_type; + //typedef typename avl_tree::value_type value_type; typedef typename avl_tree::const_reference const_reference; typedef typename const T::value_type *const_pointer; typedef const avl_tree * cntrPtr; diff --git a/TinySTL/BinarySearchTree.h b/TinySTL/BinarySearchTree.h index e4ba6ea..9fe7fd9 100644 --- a/TinySTL/BinarySearchTree.h +++ b/TinySTL/BinarySearchTree.h @@ -2,6 +2,7 @@ #define _BINARY_SEARCH_TREE_H_ #include "Allocator.h" +#include "Iterator.h" #include "Queue.h" #include "Stack.h" #include "String.h" @@ -80,12 +81,13 @@ namespace TinySTL{ namespace Detail{ //class of bst iterator template//T = node - class bst_iter{ + class bst_iter : + public iterator::value_type>{ private: template friend class ::TinySTL::binary_search_tree; private: - typedef typename ::TinySTL::binary_search_tree::value_type value_type; + //typedef typename ::TinySTL::binary_search_tree::value_type value_type; typedef typename ::TinySTL::binary_search_tree::const_reference const_reference; typedef typename const T::value_type *const_pointer; typedef const ::TinySTL::binary_search_tree * cntrPtr; diff --git a/TinySTL/List.h b/TinySTL/List.h index 465f362..065e064 100644 --- a/TinySTL/List.h +++ b/TinySTL/List.h @@ -27,7 +27,7 @@ namespace TinySTL{ }; //the class of list iterator template - struct listIterator :public bidirectional_iterator{ + struct listIterator :public iterator{ template friend class list; public: diff --git a/TinySTL/TinySTL.vcxproj b/TinySTL/TinySTL.vcxproj index 361ec6a..34a211c 100644 --- a/TinySTL/TinySTL.vcxproj +++ b/TinySTL/TinySTL.vcxproj @@ -54,7 +54,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;_LIB;NOMINMAX;%(PreprocessorDefinitions) Console @@ -69,7 +69,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;_LIB;NOMINMAX;%(PreprocessorDefinitions) Console @@ -84,6 +84,7 @@ + @@ -95,6 +96,7 @@ + @@ -107,11 +109,13 @@ + + @@ -123,6 +127,7 @@ + @@ -135,9 +140,11 @@ + + diff --git a/TinySTL/TinySTL.vcxproj.filters b/TinySTL/TinySTL.vcxproj.filters index 87faa39..0c8b459 100644 --- a/TinySTL/TinySTL.vcxproj.filters +++ b/TinySTL/TinySTL.vcxproj.filters @@ -78,6 +78,12 @@ Test + + Test + + + Test + @@ -206,6 +212,21 @@ Detail + + Test + + + Detail + + + 头文件 + + + Detail + + + Test + diff --git a/TinySTL/Unordered_set.h b/TinySTL/Unordered_set.h index 52e707f..dda04b0 100644 --- a/TinySTL/Unordered_set.h +++ b/TinySTL/Unordered_set.h @@ -4,6 +4,7 @@ #include "Allocator.h" #include "Algorithm.h" #include "Functional.h" +#include "Iterator.h" #include "List.h" #include "Vector.h" @@ -13,7 +14,7 @@ namespace TinySTL{ namespace Detail{ template, class KeyEqual = TinySTL::equal_to, class Allocator = TinySTL::allocator < Key >> - class ust_iterator{ + class ust_iterator : public iterator{ private: template friend class Unordered_set;