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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -