Sharing static members between template instantiations? (impossible?)

后端 未结 2 807
走了就别回头了
走了就别回头了 2021-01-11 18:42

I am doing something that is probably silly, but it would be nice if it worked.

I am attempting to specialize types in a way that I need my own lookup structure that

2条回答
  •  灰色年华
    2021-01-11 19:32

    You could add a non-templated base class and move lookupTable into that class:

    class Base
    {
    protected:
        static map lookupTable
    };
    
    template
    class SpecialArray : Base
    {
        //...
    };
    

提交回复
热议问题