File tree 6 files changed +31
-13
lines changed
6 files changed +31
-13
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ script:
80
80
- mkdir build && cd ./build
81
81
- cmake ..
82
82
- make
83
- - cd ../bin && ./test
83
+ - cd ../bin && ./stltest
84
84
85
85
branches :
86
86
only :
Original file line number Diff line number Diff line change @@ -12,9 +12,7 @@ message(STATUS "The version of this project is: ${MyTinySTL_VERSION}")
12
12
# build type
13
13
set (CMAKE_BUILD_TYPE release)
14
14
15
- if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
16
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} " )
17
- elseif ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "GNU" )
15
+ if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "GNU" )
18
16
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall" )
19
17
# set(EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wsign-conversion)
20
18
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0" )
Original file line number Diff line number Diff line change @@ -728,7 +728,6 @@ template <class T>
728
728
void vector<T>::
729
729
__reallocate_and_insert (iterator pos, const value_type& value)
730
730
{
731
- const auto old_size = size ();
732
731
const auto new_size = __growth_size (1 );
733
732
auto new_begin = data_allocator::allocate (new_size);
734
733
auto new_end = new_begin;
Original file line number Diff line number Diff line change @@ -7,21 +7,43 @@ MyTinySTL
7
7
8
8
## 简介
9
9
基于 ` C++11 ` 的 ` tinySTL ` ,并使用中文文档与中文注释,作为新手练习用途。实现了大部分 STL 中的容器与函数,但仍存在许多不足与 bug 。如发现错误,还请在 ` Issues ` 中指出,欢迎 ` Fork ` 和 ` Pull requests ` 改善代码,谢谢!<br >
10
-
10
+
11
11
## 支持
12
12
13
13
* 操作系统
14
14
* linux
15
15
* windows
16
+ * osx
16
17
* 编译器
17
- * G++ 4.8
18
- * Clang++ 3.5
18
+ * GCC 4.8
19
+ * Clang 3.5
19
20
* MSVC 14.0
21
+
22
+ ## 需要
23
+ * cmake 2.8 (使用g++/clang编译)
24
+
25
+ ## 运行
26
+
27
+ * linux/osx
28
+ 1 . git clone
29
+ ``` shell
30
+ $ git clone
[email protected] :Alinshans/MyTinySTL.git
31
+ ```
32
+ 2 . 构建并运行
33
+ ``` shell
34
+ $ mkdir build && cd ./build
35
+ $ cmake ..
36
+ $ make
37
+ $ cd ../bin && ./stltest
38
+ ```
39
+
40
+ * windows
41
+ 使用 ` vs2015 ` (或 ` vs2017 ` )打开 ` MyTinySTL.sln ` ,配置 ` Relase ` 模式,(Ctrl + F5)开始执行。
20
42
21
43
## 文档
22
44
见 [ Wiki] ( https://github.com/Alinshans/MyTinySTL/wiki )
23
45
24
46
## 测试
25
- 见 [ Test] ( https://github.com/Alinshans/MyTinySTL/tree/master/MyTinySTL/ Test )
47
+ 见 [ Test] ( https://github.com/Alinshans/MyTinySTL/tree/master/Test )
26
48
27
49
Original file line number Diff line number Diff line change 1
1
include_directories (${PROJECT_SOURCE_DIR} /MyTinySTL)
2
2
set (APP_SRC test .cpp)
3
3
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR} /bin)
4
- add_executable (test ${APP_SRC} )
4
+ add_executable (stltest ${APP_SRC} )
Original file line number Diff line number Diff line change @@ -324,10 +324,9 @@ template <typename T>
324
324
inline details::color_return_t <T>
325
325
operator <<(std::ostream& os, const T& value)
326
326
{
327
- const std::streambuf* buf = os.rdbuf ();
328
327
return (os.iword (details::get_iword ()) ||
329
- details::is_modifiable () &&
330
- details::is_terminal (os.rdbuf ()))
328
+ ( details::is_modifiable () &&
329
+ details::is_terminal (os.rdbuf () )))
331
330
? details::set_color (os, value)
332
331
: os;
333
332
}
You can’t perform that action at this time.
0 commit comments