I know that STL containers have a value_type parameter and I've seen how it can be used to declare a type of a variable like:
I know that STL containers have a value_type parameter and I've seen how it can be used to declare a type of a variable like
Is there any STL algorithm that would tell if a container has duplicated elements (using the operator== or a given predicate)?
Is there a way to modify the key of a std::map or ? This example shows how to do so with rebalancing the tree. But what if I provide some guarantees that the key won't need to be rebalanced?
Is it possible to evaluate std::optional::value_or(expr) argument in a lazy way, so the expr were calculated only in the case of having no value? If not, what would be a proper replacement?
I would like to insert the values from vector b to vector a, and multiply the values by -1 during the insertion. Currently I simply insert the elements, and multiply them by -1 afterwards:
I am trying to remove vector elements using remove_if. But unsuccessfully. What am I doing wrong? Here's my code:
A colleague and I were discussing the relative merits of member vs. non-member functions. A question arose: why does std::map have a find member function.
I am a newbie in c++. While reading the STL I realized that there is no std::erase provided. I am not really sure why it is not there. A valid use case is following
I have a problem with constant single element std::vector when pass through a function. C++ compiler automatically call wrong function when the std::vector variable contain a single element. This is though the policy of C++ design. However is there any explicit method to specify in such a case. Here are...