开发者

template specialization inside class namespace

开发者 https://www.devze.com 2023-01-11 20:51 出处:网络
How to specialize a template defined in some external namespace in the body of my class? Concrete example using BGL which doesn\'t compile:

How to specialize a template defined in some external namespace in the body of my class?

Concrete example using BGL which doesn't compile:

class A
{
  namespace boost
  {
    template <class ValueType>
    struct container_gen<SomeSelectorS, ValueType>
    {
      typedef std::multiset<ValueType,MyClass<ValueType> > type;
    };
  }
}

If one moves specialization of container_gen out of class A everything works great. The specifi开发者_如何学编程c problem is that I don't know how to reference "boost" namespace from class A.


You cannot create namespaces inside classes, and you cannot specialize a template in a namespace scope inside a class.

0

精彩评论

暂无评论...
验证码 换一张
取 消