我正在尝试使用emscripten编译我的项目.在Visual Studio 2013中,一切都很好.
我在这里存储函数:
template<typename Return, typename ...Arguments>
using CBFunction = std::function<Return(Arguments...)>;
typedef unsigned int CBID;
template<typename Return, typename ...Arguments>
class CBCollection
{
std::map<CBID, CBFunction<Return, Arguments...>> cbs;
public:
CBID addCB(CBFunction<Return, Arguments...> cb)
{
CBID id = findFreeID();
cbs[id] = cb;
return id;
}
...
}
Run Code Online (Sandbox Code Playgroud)
后来我可以添加简单和成员函数:
CBCollection<void, MatrixStack, float> BeforeRenderCBs;
...
AnimatedSprite::AnimatedSprite()
{
using namespace placeholders;
BeforeRenderCBs.addCB(bind(&AnimatedSprite::beforeRenderCB, this, _1, _2));
}
Run Code Online (Sandbox Code Playgroud)
与emscripten这是结果:
<scratch space>:624:1: note: expanded from here
"C:/Development/LexUnitEngine/Engine/include/Buffer.h"
^
C:\Development\LexUnitEngine\Engine\source\AnimatedSprite.cpp:76:24: error: no viable conversion from '__bind<void (AnimatedSprite::*)(MatrixStack &, float), …Run Code Online (Sandbox Code Playgroud)