c++ - 'myStateType' was not declared in this scope caused by #typedef -


i tried use #typedef declare type own customized name convenient use:

class solution { public:     void dfs(vector<vector<char>>& board, int i, int j)     {         using namespace std;         #typedef std::pair<int, int> mystatetype;          std::queue<mystatetype> q; // error on line         ...     } }; 

however, compile error indicated on line std::queue<mystatetype> q;:

'mystatetype' not declared in scope

i still haven't figure out how error have happened? ideas? in advance!

typedef compiler token in c , c++ programming languages, not macro.

typedef std::pair<int,int> mystatetype; // don't put # before std:queue<mystatetype> q; 

'mystatetype' not declared in scope: means programm not aware of type: mystatetype


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -