c++ - error:cannot appear in constant expression while using multimap -


i writng program backtrace of process having multiple threads. using multimapping backtrace of each thread can mapped corresponding threadid.

here code:

     multimap<int,std::vector<strings >frames>> mt; 

............ ............

mt.insert(pair<int,std::vector<string>(threadid,funcname)); 

when compiling getting error error:'threadid' cannot appear in constant expression error:'funcname' cannot appear in constant expression.

please me in assigning values multimap.

one obvious error missing 1 closing angular bracket. replace this:

mt.insert(pair<int,std::vector<string>(threadid,funcname)); 

with this:

mt.insert(pair<int,std::vector<string> >(threadid,funcname)); //                                     ^ here 

you can simplify using std::make_pair function template:

mt.insert(std::make_pair(threadid, funcname)); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -