我继承了一些名字不好的代码,幸运的是,我收到了一个第三方库,这让我的生活变得更加复杂。这就是我最终的结果。
class Something; // third party library
namespace Something {
class Something;
class Templated<class TemplateClass>;
}
现在我需要使用第三方库中的类“Something”作为命名空间Something下的新类的TemplateClass参数。我认为这应该工作
class Something; // third party library
namespace Something {
class Something;
class Templated<class TemplateClass>;
class Impl : public Templated< ::Something > {}
}
但是编译器不喜欢它。我编译它的唯一方法是
class Something; // third party library
class Something2 : public Something {} // dirty hack
namespace Something {
class Something;
class Templated<class TemplateClass>;
class Impl : public Templated< Something2 > {}
}
但我真的不喜欢它。必须有更好的方法来做到这一点。