简体   繁体   中英

C++ no matching function call to transform when using lambda

Okay, very stumped on this one. Works with Visual Studio, but not Code::Blocks (GNU compiler).

transform(m_teams.begin(), m_teams.end(), inserter(teamNames, teamNames.end()),
    [](stVecPair team) -> string { return team.first; });

m_teams is a map : typedef map<string, vector<Person*> > stVecMap;

teamNames is a set : typedef set<string> StrSet;

stVecPair is a pair matching m_teams : typedef pair<string, vector<Person*> > stVecPair;

Full Error

error: no matching function for call to 'transform(std::map<std::basic_string<char>, 
std::vector<Person*> >::const_iterator, std::map<std::basic_string<char>, 
std::vector<Person*> >::const_iterator, std::insert_iterator<std::set<std::basic_string<char> > >, 
RaceAnalyzer::teams() const::<lambda(RaceAnalyzer::stVecPair&)>)

如我所评论,您忘记了-std=c++11选项> o <

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM