表达时:
typedef RDOCalcUnary<RDOValue, (&RDOValue::operator-), OperatorType::OT_ARITHM> RDOCalcUMinus;
gcc显示以下错误:
在Windows下,MSVC编译器可正确编译代码。
有什么问题?我该如何解决?
template <typename ret_type, ret_type (RDOValue::*pOperator)() const, typename OperatorType::Type CalcType>
class RDOCalcUnary: public RDOCalcUnaryBase
{
friend class rdo::Factory<RDOCalcUnary<ret_type, pOperator, CalcType> >;
public:
enum { calc_type = CalcType };
typedef ret_type (RDOValue::*value_operator)() const;
static RDOSrcInfo getStaticSrcInfo(CREF(RDOSrcInfo::Position) position, CREF(LPRDOCalc) pUnaryCalc);
static value_operator getOperation ();
protected:
RDOCalcUnary(CREF(RDOSrcInfo::Position) position, CREF(LPRDOCalc) pOperation);
private:
REF(RDOValue) doCalc(CREF(LPRDORuntime) pRuntime);
};
最佳答案
当您执行typedef时,请不要使用方括号:
typedef RDOCalcUnary<RDOValue, &RDOValue::operator-, OperatorType::OT_ARITHM> RDOCalcUMinus;
它对我有用。