Blog

The Power of Hidden Friends in C++—Anthony Williams

Did you know about them?

The Power of Hidden Friends in C++

by Anthony Williams

From the article:

"Friendship" in C++ is commonly thought of as a means of allowing non-member functions and other classes to access the private data of a class. This might be done to allow symmetric conversions on non-member comparison operators, or allow a factory class exclusive access to the constructor of a class, or any number of things.

However, this is not the only use of friendship in C++, as there is an additional property to declaring a function or function template a friend: the friend function is now available to be found via Argument-Dependent Lookup (ADL). This is what makes operator overloading work with classes in different namespaces...

Space Game: A std::variant-Based State Machine by Example—Nikolai Wuttke

Did you think to use it like that?

Space Game: A std::variant-Based State Machine by Example

by Nikolai Wuttke

From the article:

One of a powerful uses of std::variant is to implement State Machines. Some time ago I showed a simple example, but today we have something bigger. In today’s article by Nikolai Wuttke you’ll see how to leverage std::variant and build a space game!

A simple workaround for the fact that std::equal takes its predicate by value—Raymond Chen

Simple and efficient.

A simple workaround for the fact that std::equal takes its predicate by value

by Raymond Chen

From the article:

The versions of the std::equal function that takes a binary predicate accepts the predicate by value, which means that if you are using a functor, it will be copied, which may be unnecessary or unwanted.

In my case, the functor had a lot of state, and I didn’t want to copy it....

C++Now 2019: Robin Kuzmin “C++Now and CppCon, the View From Inside”

What the C++Now and CppCon are.

C++Now and CppCon, the View From Inside

by Robin Kuzmin

Topics:

  • What the C++Now and CppCon are. Brief history, purpose, and difference.
  • How to attend CppCon and get money for that.
  • How to attend C++Now and CppCon for free or partially for free.
  • How to avoid the expenses for the conference ticket, hotel, flight, pre-conf- and post-conf-classes.
  • How certain parts of the conferences work. Roles, tools, how one can participate and what it gives.
  • Future of C++Now and CppCon.
  • Annual time line of CppCon and C++Now. When to do what.