2

I've tried to use an implementation namespace, but when i 'using namespace' it, it pulls in the whole implementation namespace, rendering it useless.

namespace library {
 namespace implementation {
  //implementation
 }

 using namespace implementation

 //visible identifiers
}

Is there way to hide implementation, without needing to use "implementation::" before using anything from implementation?

G_glop
  • 63
  • 1
  • 8

1 Answers1

9

rendering it useless

Well, it's not useless, you just can't using namespace it. You have to explicitly prepend implementation:: to the names in it. For this reason, it might make sense to choose a shorter name (detail is commonly used in c++ projects for this purpose).

Also, I'd like to point out that header-only and implementation hiding are two somewhat conflicting requirements. If you truly need to hide the implementation, you can't go header-only.

Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180