看到c++ primer上说尽量不要用数组指针 如题,不知道各位前辈在写c++程序时一般都是优先考虑容器的吗? c++ [解决办法] Yes. always STL container. This is part of modern C++. I am surprised that lots of programmers in China still suffer from pointer pain in C++. [解决办法] C++的话,当然首先考虑用STL中的容器。
Yes. always STL container. This is part of modern C++. I am surprised that lots of programmers in China still suffer from pointer pain in C++.
有同感,不知道为何一堆人还在写c with classes,偏偏他们写的东西性能,可读性,灵活性都 远不如stl已经提供的组件;这些坚持自己动手比较好的人,其水平大部分都跟某神棍一样高 [解决办法]
C++的话,当然首先考虑用STL中的容器。
如题,不知道各位前辈在写c++程序时一般都是优先考虑容器的吗?
用数组和指针和用容器比起来效率相差的大吗?
Your question is too vague, it's hard to give you the correct answer. It actually depends on how you use array or vector, where do you use it. In most cases, STL/string should be default container and unique_ptr/shared_ptr should be default if you use pointer. [解决办法]