Question

I'm trying to create a simple function that makes a simple test and return true or false.

myfunct = (_3 < someArray[i]);

When I do this, I get this error :

error: no match for 'operator<' in '<unnamed>::_1 < depths[i]'

What I hope is get something equivalent to this

bool myFunct(unsigned int a, unsigned int b, unsigned int c, unsigned int d)
{
   return c < 22; // Suppose 22 was in someArray[i]
}
Was it helpful?

Solution

Are you sure you've got the namespaces right?

It should be either

using namespace boost::lambda;

or

boost::lambda::_1

Remember that placeholders are used in other parts of boost, or in other libraries (conflict with a local TR1 may happen!), which may induce errors.

OTHER TIPS

The following compiles without any errors, how does the rest of your code look like?

#include <boost/function.hpp>
#include <boost/lambda/lambda.hpp>

using namespace boost;
using namespace boost::lambda;

int main(void)
{
    int someArray[5];
    int i;
    function<bool(int,int)> f = (_1 < someArray[i]);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top