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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -