All posts in "STL"

How to Transfer unique_ptrs From a Set to Another Set

Published November 6, 2018 - 2 Comments
move unique_ptr C++ sets

Transferring a std::unique_ptr to another std::unique_ptr is an easy thing to do: std::unique_ptr<int> p1 = std::make_unique<int>(42); std::unique_ptr<int> p2; p2 = std::move(p1); // the contents of p1 have been transferred to p2 Easy peasy, lemon squeezy. Now what if those unique_ptrs are living inside of two sets? It should be just as easy to transfer those in the […]

How to Remove Duplicates from an Associative Container in C++

Published September 25, 2018 - 10 Comments

For the third episode in our series about removing things from C++ containers, let’s tackle the tricky topic of removing duplicates from associative containers! The articles of the series are: How to Remove Elements from a Sequence Container (vector, string, deque, list) How to Remove Pointers from a Vector in C++ (co-written with Gaurav Sehgal) How […]

How to Remove Elements from an Associative Container in C++

Published September 21, 2018 - 11 Comments
remove mltimap map set multiset

Welcome back for our second part in our series on removing elements from C++ containers! How to Remove Elements from a Sequence Container (vector, string, deque, list) How to Remove Pointers from a Vector in C++ (co-written with Gaurav Sehgal) How to Remove Elements from an Associative Container (maps and sets) How to Remove Duplicates from […]

How to Remove Pointers from a Vector in C++

Published September 18, 2018 - 6 Comments

Today we have a post co-written with Gaurav Sehgal, a software engineer who works with C and C++. Gaurav can be found on his Stack Overflow profile as well as on LinkedIn. Interested in writing on Fluent C++ too? Check out our guest posting area! As we saw in the article about removing elements from […]

How to Remove Elements from a Sequence Container in C++

Published September 14, 2018 - 22 Comments

As part of the STL Learning Resource, we’re tackling today the STL algorithms that remove elements from a collection. Removing an element from a C++ collection can’t be that complicated, can it? Well, how can I put it… It has a rich complexity, let’s say. Ok, maybe it’s a little complicated. We will cover this […]

105 STL Algorithms in Less Than an Hour

Published July 10, 2018 - 0 Comments
105 STL algorithms in less than an hour

Everyone knows that it’s a good thing to know the STL algorithms. But do know each and every one of them? To learn all there is in the STL algorithms library, I’ve presented a talk at several conferences this year, that was titled 105 STL Algorithms in Less Than an Hour. The point of this […]

The World Map of C++ STL Algorithms

Published July 6, 2018 - 5 Comments
world map C++ STL algorithms

We all know that we should know our STL algorithms, because they help make our code more expressive and more robust (sometimes in spectacular ways!). But do you know all your STL algorithms? There are 105 of them if we include those of C++17, and every one of them has a chance to be useful […]

1 5 6 7 8 9 12