the function is a std::function<void(string a) write;
ok.... it's void.... but why the error about it???
what means these error?

Recommended Answers

All 4 Replies

Should be something like the following:

int foo(double a) {

    return a;
}

std::function<void(double)> call_foo = &foo;

i'm confuse the 'void' isn't the return type?

see these exemple:

#include <iostream>
#include <functional>

using namespace std;

class test
{
    public:
    function<void(void)> Message;
};

class a: public test
{
}a;

void a::Message=[]()
{
    cout << "hello world";
}

int main()
{
    a.Message();
    return 0;
}

error: "variable or field 'Message' declared void"
why these error?

int main(){

std::fuction<void(const &a,void)>pp =&a::message();
pp();
return 0;
}

you need to write your class well. look into it more cpp0x help on fuctional.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.