MyTinySTL
MyTinySTL copied to clipboard
Achieve a tiny STL in C++11
vector.h中:allocator_type get_allocator() { return data_allocator(); } list.h中:allocator_type get_allocator() { return node_allocator(); } deque.h中:allocator_type get_allocator() { return allocator_type(); } 为什么函数返回值类型都是allocator_type,但是函数体中 return 的确是不同的对象呢?
Modified an annotation error "TEXT" -> "TEST"
对于已经定义了下面的copy构造函数: ``` // implicit constructiable for other pair template ::type = 0> constexpr pair(const pair& other) : first(other.first), second(other.second) { } ``` 为什么还要定义explicit的copy构造函数: ``` // explicit constructiable for other pair...
 这里的Arg1是不是应该是Arg2.
不好意思,我算是小白中的小白了,直接下载代码之后用vs17打开sln,并尝试用release模式运行,结果编译器报错 错误 C2059 语法错误:“)” MyTinySTL d:\code\mytinystl-master\mytinystl-master\test\algorithm_test.h 722 按理来说不应该出现语法相关的报错才对,我应该使用vs15和c++11来学吗
(新手观点,大佬轻喷) 目前版本的construct的可变参数模板版本并不能有效地让自定义类通过construct来创建对象,如: 对于如下代码: ~~~ #include #include"allocator.h" using namespace std; class A{ public: A(int a):m(a),n(0.0){ cout
` friend bool operator==(const set& lhs, const set& rhs) { return lhs.tree_ == rhs.tree_; } friend bool operator< (const set& lhs, const set& rhs) { return lhs.tree_ < rhs.tree_; }`...
如果你下载了代码,运行的时候,提示你某个地方的右括号“)”语法错误,怎么办?这大概率是因为后面跟着一行或多行注释,部分编译器编译到这里的时候就会出错。解决办法:删掉这些注释!就解决了!
在 ````cpp // fill_init 函数 template void vector:: fill_init(size_type n, const value_type& value) { const size_type init_size = mystl::max(static_cast(16), n); init_space(n, init_size); mystl::uninitialized_fill_n(begin_, n, value); `}` ```` 中,为什么要有 const size_type...