By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

minimize DFA c++ code has error

P: 1

I have a problem In this code

//Function to minimize DFA
pair<int,vector<string tuple<int,int,bool>> > minimize_dfa(vector<dst) {
vector<int> grp(dfa.size()); /// Group number for states
vector<vector<int> > part(2, vector<int>()); /// Partition for groups

/// Initializing the groups
int part[0],.push_back(0);
for(int i=1; i<(int)grp.size(); i++) {
if(dfa[i].f==dfa[0].f) {
} else {

if(!part[1].size()) part.erase(part.end());

in the first line this message will appear
([Error] template argument 1 is invalid)

does any one know about this situation ?
Dec 16 '17 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,197
Your function template minimize_dfa has an argument of vector<dst.

What is vector<dst ?? There's a missing > and an argument name.

Did you mean vector<dst> arg1 ??

There's also a typecast of grp.size() to an int. Anytime you cast in C++ it's an error unless you are interfacing with old-style C code. In this case vector::size returns a size_type, not an int.

You should be using iterators with vectors.
Dec 16 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.