如何创建一个简单的 boost::lambda 函数?
我正在尝试创建一个简单的函数来进行简单的测试并返回 true 或 false。
myfunct = (_3 < someArray[i]);
当我这样做时,我收到此错误:
error: no match for 'operator<' in '<unnamed>::_1 < depths[i]'
我希望得到与此等效的东西
bool myFunct(unsigned int a, unsigned int b, unsigned int c, unsigned int d)
{
return c < 22; // Suppose 22 was in someArray[i]
}
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]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您确定命名空间正确吗?
应该是
或者
请记住,占位符用于 boost 的其他部分,或者其他库(可能会与本地 TR1 发生冲突!),这可能会引发错误。
Are you sure you've got the namespaces right?
It should be either
or
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.
以下编译没有任何错误,您的其余代码是什么样子的?
The following compiles without any errors, how does the rest of your code look like?