parallel101 / stl1weekend

Build your own STL in one weekend
166 stars 13 forks source link

编译map容器出现bug #2

Closed qwerfdsadad closed 1 month ago

qwerfdsadad commented 1 month ago

环境配置: ubantu 20.04.3 LTS cmake: 3.16.3 gcc:11.5

make命令输出:

[ 10%] Built target test_Utility
[ 20%] Built target test_UniquePtr
[ 30%] Built target test_Vector
[ 40%] Built target test_Set
[ 50%] Built target test_List
[ 60%] Built target test_Optional
[ 70%] Built target test_Function
[ 75%] Building CXX object CMakeFiles/test_Map.dir/test_Map.cpp.o
/home/cpp/stl1weekend/test_Map.cpp: In function 'int main()':
/home/cpp/stl1weekend/test_Map.cpp:16:41: error: 'struct _RbTreeIterator<_RbTreeNodeImpl<std::pair<const std::__cxx11::basic_string<char>, int> >, std::pair<const std::__cxx11::basic_string<char>, int>, false>' has no member named '_M_node_ptr'
   16 |     std::cout << "current it is " << it._M_node_ptr() << " " << (it != table.end() ? it->second : -1) << ", and tree is ";
      |                                         ^~~~~~~~~~~
/home/cpp/stl1weekend/test_Map.cpp:17:11: error: 'struct Map<std::__cxx11::basic_string<char>, int>' has no member named '_M_print'
   17 |     table._M_print(std::cout);
      |           ^~~~~~~~
/home/cpp/stl1weekend/test_Map.cpp:19:41: error: 'struct _RbTreeIterator<_RbTreeNodeImpl<std::pair<const std::__cxx11::basic_string<char>, int> >, std::pair<const std::__cxx11::basic_string<char>, int>, false>' has no member named '_M_node_ptr'
   19 |     std::cout << "current it is " << it._M_node_ptr() << " " << (it != table.end() ? it->second : -1) << ", and tree is ";
      |                                         ^~~~~~~~~~~
/home/cpp/stl1weekend/test_Map.cpp:20:11: error: 'struct Map<std::__cxx11::basic_string<char>, int>' has no member named '_M_print'
   20 |     table._M_print(std::cout);
      |           ^~~~~~~~
make[2]: *** [CMakeFiles/test_Map.dir/build.make:63: CMakeFiles/test_Map.dir/test_Map.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:283: CMakeFiles/test_Map.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
archibate commented 1 month ago

多谢提醒,已修复。