【问题标题】:error C2544: expected ')' for operator '()'错误 C2544:操作员 '()' 应为 ')'
【发布时间】:2012-11-07 06:18:03
【问题描述】:

我收到以下错误。

typedef std::vector<std::pair<std::string, void*> >  PropInfoType;
#define REGISTER_FUNCTOR(type, func) \
  template <typename OWNER> \
  struct writeCharFunctor { \
    void operator(PropInfoType::iterator& it)() { \
    } \
  };

  REGISTER_FUNCTOR(char,writeChar);

MSDN 只是说这是由于macro expansion

如果我将 void operator(PropInfoType::iterator&amp; it)() 更改为 void operator()() 它可以工作

【问题讨论】:

    标签: c++ templates macros


    【解决方案1】:

    它可能应该包含

     void operator () (PropInfoType::iterator& it) { \
    

    因为operator关键字后面应该跟操作符本身。

    【讨论】:

      猜你喜欢
      • 2018-07-13
      • 2015-04-13
      • 2011-10-29
      • 2012-06-18
      • 2012-02-11
      • 1970-01-01
      • 2021-03-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多