inline namespaces
Inline namespace can be used for versioning API without annoying users:
namespace pokemon { |
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 { |
Now the same call will result updated behaviour:
std::cout << pokemon::choose(); // Pikachu |
more on: