Misc

Why std::u8string lacks support in other C++ standard functions?

An interesting discussion on the problems of UTF-8 support, and how std::u8string is considered a bad idea by some.

On variables being marked as constants

Some nice ideas about possible problems with (named) return-value optimization (NRVO). Also, ideas like using const to make all variables const by default.

More or less the opposite approach: when not to use const (most of the times for the author; though I disagree).

Coroutines

Carbon

Shared pointers or general architechture and ownership

Herb Sutter, on "Leak freedom in C++ by default": "preventing upward ownership, don’t store an strong owner in a callback"

Signed vs unsigned

Bit sets

Enumerations

Polls

Algorithm issues

I don’t find algorithm that useful all the time. Here are some examples:

Doing two things at once

You can find for something, but not find for two different things and get two results:

QString path::completeBaseName(const QString& path)
{
    const int lastSlash = path.lastIndexOf(QLatin1Char('/'));
    const int lastDot = path.lastIndexOf(QLatin1Char('.'));
    return path.mid(lastSlash + 1, (path.size() - lastSlash) - (path.size() - lastDot + 1));
}

The above is done here with helper functions that are basically algorithms. But we need two calls and two scans through the string to get the 2 values. A loop could do it in one.

Behavior on empty containers

Sometimes one needs specific behavior on an empty container which might not the default.

auto matches = [](const QString& value) {
    return [kind = value.toLower()](const QString& item) {
        return kind.contains(item);
    };
};
bool success = m_types.isEmpty() ||
               std::any_of(m_types.begin(), m_types.end(), matches(row.type));