Top "Stl-algorithm" questions

A collection of algorithms defined as template functions in the <algorithm> header of C++'s standard library.

how to find the intersection of two std::set in C++?

I have been trying to find the intersection between two std::set in C++, but I keep getting an error. …

c++ std stl-algorithm stdset
What is the difference between std::transform and std::for_each?

Both can be used to apply a function to a range of elements. On a high level: std::for_each …

c++ c++11 stl-algorithm
How to use std::find/std::find_if with a vector of custom class objects?

I have a class representing a user called Nick and I want to use std::find_if on it, where …

stl stl-algorithm c++
The fastest way to find union of sets

I have sets of pairs of int like set<pair<int,int> > x1, x2, ... xn ( n …

c++ algorithm stl stl-algorithm
std::next_permutation Implementation Explanation

I was curious how std:next_permutation was implemented so I extracted the the gnu libstdc++ 4.7 version and sanitized the …

c++ c++11 permutation stl-algorithm lexicographic
How to remove duplicates from unsorted std::vector while keeping the original ordering using algorithms?

I have an array of integers that I need to remove duplicates from while maintaining the order of the first …

c++ duplicates stdvector stl-algorithm stdset
STL vector reserve() and copy()

Greetings, I am trying to perform a copy from one vector (vec1) to another vector (vec2) using the following 2 abbreviated …

c++ stl vector stl-algorithm
Why is there no transform_if in the C++ standard library?

A use case emerged when wanting to do a contitional copy (1. doable with copy_if) but from a container of …

c++ c++-standard-library stl-algorithm
std::sort() on a vector of Class pointers

I have a vector of class pointers std::vector<Square*> listSquares. I want to sort it with one …

c++ sorting stl stl-algorithm
Find last element in std::vector which satisfies a condition

I have this requirement to find the last element in the vector which is smaller than a value. Like find_…

c++ c++11 vector stl stl-algorithm