C++ STL doubly linked list performance comparison [closed] - c++

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I would like to know if implementing my own Doubly Linked List is better or using stl list.h ?
in terms of efficiency and what would be the advantages and disadvantages of both ?
Thanks

The only way to know is to profile. Here are some tools.
As already said in the comments, unless this is an educational exercise you probably don't want to write your own.
There is an alternative to std::list, Boost.Intrusive which may have better performance than std::list.

Related

The copy-and-swap idiom in C++20 [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 months ago.
Improve this question
I found this great answer from 12 years ago that explains the copy-and-swap idiom and how to implement it in C++11 and C++03.
My question is: is this still the recommended solution or has it changed in later versions of C++? (specifically I'm currently using C++20)
If you need safety and comfort over performance, it is still best solution. Howard Hinnant recommends you roll your own but only if you really really know how to do it and really really need the last ounce of performance.

Is it good to have an idea about the STL before studying Data Structures? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm currently self-studying C++ and I'm about to finish my OOP course, till now, I've finished the OOP concepts but the course also includes an introduction to the STL, but I feel like it's too early to have a look on the STL at this stage(before studying Data Structures).
Is it a good idea to skip the last part of the OOP course and start studying Data Structures right now? or should I complete the course anyway?
In my opinion, if you already can understand OOP principles you should use STL and do not care how it really works under the hood, but after that, you should learn basic data structures and all will come clear for you.

Is there any reason why I shouldn't use function objects instead of functions? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've been trying to teach myself how to program by working through the book Programming: Principles and Practice Using C++ by Bjarne Stroustrup and I recently learned about function objects, the way it was described in the book it seems like I shouldn't ever use regular functions and should always use function objects instead, even if I don't need a state for the function. I couldn't find anything on this site or using goolge to check if I should be using them that way or not. Is it wrong? Are there any down sides to using them? Thank you in advance for helping.

Should I learn to use the C++ STL containers instead of building them? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've learned about data structures and algorithms in my university course and they taught us how to implement them. After reading some answers on SO and Quora, it seems that using the STL containers are recommended.
As a software engineer/developer, you should know how a particular data structure works under the hood. and you should be able to customize/invent one when you need it. that's the reason they thought you so.
But generally you won't need to reinvent the wheel. so when there are tried and tested data structures available, like the std::stack, there's no need to do it again. specially because you'll have more bug issues in your implementation than those of STL or any other well designed one like Boost.
Unless you think you have a better knowledge of software engineering than the designers of the STL - or you have some very specific hardware requirements that they are unaware of

Is relying on short-circuit evaluation good design? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Are there alternatives that would be more preferred?
Short-circuit evaluation is a crucial feature of most modern programming languages and there's no reason to avoid relying on it. Without it pointer-related tests would be (unnecessarily) much more complicated and less readable.
Of course it's good design, everyone knows to expect it and it beats using nested conditionals.