Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost C++ macro argument count error

In the following piece of code:

BOOST_FOREACH(std::pair<PID, bool> &itval, completedEs_) {
    allCompleted &= it->second;
}

I'm getting this error:

error: macro "BOOST_FOREACH" passed 3 arguments, but takes just 2

I'm only passing 2 arguments, what's going on?

like image 876
Matt Joiner Avatar asked Jun 27 '26 17:06

Matt Joiner


1 Answers

The first type is being parsed as two arguments since it contains a comma. As a workaround you could typedef the type:

typedef std::pair<PID, bool> PID_bool_pair;
BOOST_FOREACH( PID_bool_pair &itval, completedEs_) {
    ...
}
like image 172
Alex Deem Avatar answered Jun 29 '26 05:06

Alex Deem