Add #include <functional>
to the top of your code.
Also remember to use -std=c++0x (or equivalent) in your compiler parameters; this will enable C++11 standard which is required for std::function
.
Domanda
I have the following code:
@interface Model ()
{
//...
std::function<bool(CGFloat, CGFloat)> greaterThan;
std::function<bool(CGFloat, CGFloat)> lesserThan;
//...
}
@end
Everything worked fine in my original project. I just created a new project, and dragged and dropped the files between the two, and in the new project I have the following errors for the above two lines:
No type named 'function' in namespace 'std'
I don't know what the problem is - The files are .mm , why can't it find function in the names space std ?
Soluzione
Add #include <functional>
to the top of your code.
Also remember to use -std=c++0x (or equivalent) in your compiler parameters; this will enable C++11 standard which is required for std::function
.