diff --git a/TinySTL/Queue.h b/TinySTL/Queue.h index c9d7388..8a6b782 100644 --- a/TinySTL/Queue.h +++ b/TinySTL/Queue.h @@ -2,6 +2,7 @@ #define _QUEUE_H_ #include "Deque.h" +#include "Functional.h" #include "Vector.h" namespace TinySTL{ diff --git a/TinySTL/String.h b/TinySTL/String.h index e598500..ff5ee9f 100644 --- a/TinySTL/String.h +++ b/TinySTL/String.h @@ -4,6 +4,7 @@ #include "Allocator.h" #include "ReverseIterator.h" #include "UninitializedFunctions.h" +#include "Utility.h" #include #include @@ -122,9 +123,9 @@ namespace TinySTL{ string& replace(iterator i1, iterator i2, InputIterator first, InputIterator last); void swap(string& str){ - std::swap(start_, str.start_); - std::swap(finish_, str.finish_); - std::swap(endOfStorage_, str.endOfStorage_); + TinySTL::swap(start_, str.start_); + TinySTL::swap(finish_, str.finish_); + TinySTL::swap(endOfStorage_, str.endOfStorage_); } size_t copy(char* s, size_t len, size_t pos = 0) const{ auto ptr = TinySTL::uninitialized_copy(begin() + pos, begin() + pos + len, s); diff --git a/TinySTL/TinySTL.vcxproj b/TinySTL/TinySTL.vcxproj index eb56b30..28ffe5d 100644 --- a/TinySTL/TinySTL.vcxproj +++ b/TinySTL/TinySTL.vcxproj @@ -99,6 +99,7 @@ + diff --git a/TinySTL/TinySTL.vcxproj.filters b/TinySTL/TinySTL.vcxproj.filters index e5fb7a4..ea8ac16 100644 --- a/TinySTL/TinySTL.vcxproj.filters +++ b/TinySTL/TinySTL.vcxproj.filters @@ -77,5 +77,8 @@ 头文件 + + 头文件 + \ No newline at end of file diff --git a/TinySTL/Utility.h b/TinySTL/Utility.h new file mode 100644 index 0000000..1446094 --- /dev/null +++ b/TinySTL/Utility.h @@ -0,0 +1,13 @@ +#ifndef _UTILITY_H_ +#define _UTILITY_H_ + +namespace TinySTL{ + //************ [swap] *************** + template + void swap(T& a, T& b){ + T temp = a; + a = b; + b = temp; + } +} +#endif \ No newline at end of file