views:

83

answers:

1

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 specific problem is that I don't know how to reference "boost" namespace from class A.

+3  A: 

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

David Rodríguez - dribeas