Given:
namespace A {
class Foo;
class Bar;
}
namespace B {
class Foo;
class Bar;
}
I want to template a class on the namespace A or B such that the following works:
template<name> class C {
name::Foo* foo;
name::Bar* bar;
}
Can this be done directly or do I need to create a pair of struct types with typedefs in them?
You can’t template on a namespace. If you’re able to use a class (with most likely public attributes/static methods) then you can template on the class as a semi-workaround.