c++ - Something wrong with enum -
c++ - Something wrong with enum -
i've like:
enum direction{forward,backward}; template<direction dir = forward> class x { private: direction my_direction_; public: void set_direction(direction dir)//here i'm getting error { my_direction_ = dir; } };
error: declaration of 'direction dir' reason why? btw, compile vs2010.
change:
template<direction dir = forward>
to
template<direction direction = forward>
the error on gcc more descriptive:
prog.cpp: in fellow member function ‘void x<dir>::set_direction(direction)’: prog.cpp:11: error: declaration of ‘direction dir’ prog.cpp:3: error: shadows template parm ‘direction dir’
c++
Comments
Post a Comment