C++

Asked • 09/30/19

What are inline namespaces for?

C++11 allows `inline namespace`s, all members of which are also automatically in the enclosing `namespace`. I cannot think of any useful application of this -- can somebody please give a brief, succinct example of a situation where an `inline namespace` is needed and where it is the most idiomatic solution? (Also, it is not clear to me what happens when a `namespace` is declared `inline` in one but not all declarations, which may live in different files. Isn't this begging for trouble?)

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.