How do I reverse a C++ vector?
Is there a built-in vector function in C++ to reverse a vector in place? Or do you just have to do it manually? … Read more
Is there a built-in vector function in C++ to reverse a vector in place? Or do you just have to do it manually? … Read more
My understanding is that string is a member of the std namespace, so why does the following occur? #include <iostream> int main() { … Read more
What are some really good reasons to ditch std::allocator in favor of a custom solution? Have you run across any situations where it … Read more
Is it possible in C++ to replace part of a string with another string? Basically, I would like to do this: QString string(“hello … Read more
I’m practicing using mulitple files and header files etc. So I have this project which takes two numbers and then adds them. Pretty … Read more
I’ve got code that looks like this: for (std::list<item*>::iterator i=items.begin();i!=items.end();i++) { bool isActive = (*i)->update(); //if (!isActive) // items.remove(*i); //else other_code_involving(*i); } items.remove_if(CheckItemNotActive); … Read more
C++11 vectors have the new function emplace_back. Unlike push_back, which relies on compiler optimizations to avoid copies, emplace_back uses perfect forwarding to send … Read more
Someone brought this article to my attention that claims (I’m paraphrasing) the STL term is misused to refer to the entire C++ Standard … Read more
All I want to do is to check whether an element exists in the vector or not, so I can deal with each … Read more
I’ve been told by others that writing using namespace std; in code is wrong, and that I should use std::cout and std::cin directly … Read more