inline namespaces

Inline namespace can be used for versioning API without annoying users:

namespace pokemon {
std::string choose() noexcept { return "Pichu"; }
}
std::cout << pokemon::choose(); // Pichu 

The lovely Pichu is evolved into the Pikachu. To choose it, we versioned the API and put the old function in namespace v0, then put the updated one in inline namespace v1:

namespace pokemon {

namespace v0 {
[[deprecated]] std::string choose() noexcept { return "Pichu"; }
}

inline namespace v1 {
std::string choose() noexcept { return "Pikachu"; }
}

}

Now the same call will result updated behaviour:

std::cout << pokemon::choose(); // Pikachu

more on: