Hello!
Imagine that you have e.g. a library that you support. The original version of the library, wrapped in a namespace, contains a class Foo:
namespace OurAwesomeLibrary {
class Foo { ... }
}
Users access Foo via `OurAwesomeLibrary::Foo`, or `using OurAwesomeLibrary; Foo`, as expected.
Now, everything is fine for a while with Version 1, but when time comes for Version 2, you find that you need to make a breaking API change to Foo. Some of your users will certainly use Version 2 features, but some need to stick with Version 1. To support both versions, you can do the following:
namespace OurAwesomeLibrary {
inline namespace v1 {
class Foo { ... } // the original, V1 class Foo
}
inline namespace v2 {
class Foo { ... } // the new, V2 class Foo
}
}
Now, *both* versions of Foo are available. Users who reference Foo as they did, previously (e.g. `OurAwesomeLibrary::Foo`) will now get the new, V2 (OurAwesomeLibrary::v2::Foo` version, by default. Users who need to get the V1 version, will need to explicitly name it `OurAwesomeLibrary::v1::Foo`.
So, a use which is idiomatic, and needed (if you want to keep both versions of Foo available in the same [outer] namespace (`OurAwesomeLibrary`, in this case. For more detail, check out https://foonathan.net/2018/11/inline-namespaces/
As to your question of "what happens when a `namespace` is declared `inline` in one but not all declarations, which may live in different files", I *suspect* that the inline qualification will apply (is carried over) to all of the declarations, but I'm not familiar enough with the standard to be absolutely certain.