#include <iostream>
int add( int , int ) ;
int main( ) {
using IntFunction = int ( * ) ( int , int ) ;
IntFunction IntFunc;
IntFunction* IntFunc2;
IntFunc = & add;
std:: cout << ( *** IntFunc) ( 1 , 2 ) << std:: endl ;
IntFunc2 = & IntFunc;
std:: cout << std:: invoke ( IntFunc2, 3 , 4 ) << std:: endl ;
return 0 ;
}
int add( int a, int b) {
std:: cout << "add" << std:: endl ;
return a+ b;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgppbnQgYWRkKGludCwgaW50KTsKCmludCBtYWluKCkgewogIHVzaW5nIEludEZ1bmN0aW9uID0gaW50ICgqKShpbnQsIGludCk7CgogIEludEZ1bmN0aW9uIEludEZ1bmM7CiAgSW50RnVuY3Rpb24qIEludEZ1bmMyOwoKICBJbnRGdW5jID0gJmFkZDsKICBzdGQ6OmNvdXQgPDwgKCoqKkludEZ1bmMpKDEsIDIpIDw8IHN0ZDo6ZW5kbDsKCiAgSW50RnVuYzIgPSAmSW50RnVuYzsKICBzdGQ6OmNvdXQgPDwgc3RkOjppbnZva2UoSW50RnVuYzIsIDMsIDQpIDw8IHN0ZDo6ZW5kbDsKCiAgcmV0dXJuIDA7Cn0KCmludCBhZGQoaW50IGEsIGludCBiKSB7CiAgc3RkOjpjb3V0IDw8ICJhZGQiIDw8IHN0ZDo6ZW5kbDsKICByZXR1cm4gYStiOwp9
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:21: error: ‘invoke’ is not a member of ‘std’
std::cout << std::invoke(IntFunc2, 3, 4) << std::endl;
^~~~~~
stdout