0

の多くの定義を生成しようとしていますtemplate struct

#define REGISTER_FUNCTOR(type, func) \
  template <OWNER> \
  struct writeCharFunctor { \
    void operator(PropInfoType::iterator& it, PdxWriterPtr pw)() { \
      MemberProperty<OWNER,type> *ptr = (MemberProperty<OWNER, type> *)it->second; \
      const char *propertName = ptr->m_propertyName.c_str(); \
      if ( !ptr->m_getterFn ) { \
        throw; \
      } \
      pw->###func(propertName,(pOwner->*(ptr->m_getterFn))()); \
    } \
  };

  REGISTER_FUNCTOR(char,writeChar);

しかし、コンパイラエラーが発生していますerror C2061: syntax error : identifier 'OWNER' My function names are different for each type, so cannot use directly template parameter (またはこれを行う方法があります)

4

1 に答える 1

2

template <class OWNER>または_template <typename OWNER>

于 2012-11-07T05:53:51.507 に答える