1

I have

template <class ElemType>
class FunctionNode : public ComputationNode<ElemType>
{
    typedef void(*TensorFunctionFunc)  (TensorView<ElemType>&);

    static const map <string, TensorFunctionFunc> fmap;

and in the cpp

template <class ElemType>
const map <string, TensorFunctionFunc> FunctionNode::fmap = FunctionNode::create_map();

However i get a variety of errors , tried using as well. Any ideas ? Also i don't think i can use std::function() since i'm using dlopen.

Quite a few similar questions but none covering a static map of function pointer , in a template .

This is not a duplicate of "Why can templates only be implemented in the header file? 12 answers" since even when using the header it does not work due to the static ! . This requires completely different initialization. ( the answers there do not work) ..

user1496062
  • 1,309
  • 1
  • 7
  • 22

0 Answers0