Jonathan Boccara's blog

What std::exchange does, and how to remember it

Published September 18, 2020 - 0 Comments

std::exchange was introduced in the C++ standard library in C++14 under the header <utility>. Its name suggests that it’s a general-purpose and useful function, and its template prototype working with any type confirms this impression. I don’t know about you, but I always had a problem with std::exchange: I couldn’t remember what it was doing. I […]

Replacing CRTP Static Polymorphism With Concepts

Published September 11, 2020 - 0 Comments

This is a guest post from Matthew Guidry. Matthew works as a software engineer in the CAD industry. He designs libraries and cross platform desktop applications, and is interested in using modern C++ techniques to improve overall software architecture. You can find Matthew online on Twitter @mguid2088. One of the usages of the CRTP is […]

Make Your September Matter

Published September 4, 2020 - 0 Comments

This is it. We’re in September. Summer is fading away behind us, time is flying by and a new year is already starting now. Yes, I consider September to be a beginning of the year. It’s the new academic year, the new ecclesiastical year, the new Jewish year, and I guess the new year in […]

Use Private Inheritance to Restrict Interfaces

Published August 28, 2020 - 0 Comments

This is a guest post from Federico Kircheis. Federico is a (mainly C++) developer in Berlin, always looking how to improve himself, and finding interesting problems to solve. Federico is the author of the viral post Function Poisoning in C++. Inheritance is a form of code reuse and does not necessarily indicate a relationship between […]

Algorithms on Sets That Return a Boolean: Implementing the Generic Algorithm

Published August 14, 2020 - 0 Comments

In the last post in our series on sets, we’ve uncovered 8 algorithms on sets that return a boolean, providing various sorts of comparisons between those two sets: std::includes share_element is_prefix_of is_one_prefix_of_other equivalent disjoint is_before is_after We also saw that each of those algorithm corresponds to a combination of 4 customisation points in a generic […]

If you see cut-paste, it is rotate

Published August 7, 2020 - 0 Comments

Today we’re taking a small break in our summer series on sets to take a refreshing dip into STL algorithms, with this guest post by Abhinav Badola. Abhinav is an open-source enthusiast who loves using C++ for learning and teaching programming concepts. You can find him on Twitter @AbhinavBadola. Thanks to Sarfaraz Nawaz and Nitul […]

Algorithms on Sets That Return a Boolean: Exploring the algorithms

Published July 31, 2020 - 0 Comments

In a previous article on sets we’ve designed share_element, an algorithm on sets (sorted collections) that returns a boolean indicating whether they have a element in common, and that operates in linear time. On the other hand, the STL also offers an algorithm on sets that return a boolean: std::includes. std::includes takes two sets and returns a […]

Implementing set_match in One Line of Code

Published July 17, 2020 - 0 Comments

In the previous post we’ve implemented set_match, an algorithm on sets inspired from the STL ones, that pairs up matching elements between two sorted collections. Being an algorithm on sets, the code we wrote for it looks like a typical implementation of an algorithm on set: template<typename Set1, typename Set2, typename OutputIterator, typename Comparator> OutputIterator set_match(Set1&& […]

1 6 7 8 9 10 45