Possible Duplicate:
demote boost::function to a plain function pointer如何從`boost :: function <var(void *,var)>`獲取C指針(如`var(*)(void *,var)``)?
於是我就用Flash C++ Compiler (aka flascc, alchemy)和就吃這樣的代碼:
boost::function<var (void*, var)> f = boost::bind(&as3_socket::socket_socketData, this, _1, _2);
socket->addEventListener(flash::events::ProgressEvent::SOCKET_DATA, Function::_new(f, NULL));
得到下一個編譯器錯誤:
$ g++ $JN -static -emit-llvm -c src/utils/http/as3_socket.cpp -I../boost/boost_libraries/install-dir/include
src/utils/http/as3_socket.cpp: In constructor ‘as3_socket::as3_socket()’:
src/utils/http/as3_socket.cpp:75: error: no matching function for call to ‘AS3::ui::Function::_new(boost::function<AS3::ui::var()(void*, AS3::ui::var)>*, NULL)’
/cygdrive/c/Users/Avesta/Downloads/FlasCC_1.0.1134176_11-09-2012/sdk/usr/bin/../../usr/include/AS3++/builtin.h:179: note: candidates are: static AS3::ui::Function AS3::ui::Function::_new()
/cygdrive/c/Users/Avesta/Downloads/FlasCC_1.0.1134176_11-09-2012/sdk/usr/bin/../../usr/include/AS3++/builtin.h:180: note: static AS3::ui::Function AS3::ui::Function::_new(AS3::ui::var (*)(void*, AS3::ui::var), void*)
所以現在的問題是如何從boost::function<var (void*, var)>
多個C風格得到var (*)(void*, var)
請有人創建flascc標記... – myWallJSON
http://stackoverflow.com/questions/282372/demote-boostfunction-to-a-plain-function-pointer是你想要的? –
錯誤來自g ++。無關緊要,你通過flascc調用它。無論您想將輸出轉換爲閃光燈都無關緊要。這是一個簡單的C++問題。 –