在禁用/ Gm并启用/ MP后,VS2010上的构建时间显着减少.
我很困惑为什么/ Gm是默认值.我认为/ MP更好.
(如果/ Gm已启用,/ MP由于不兼容而未激活.Activated/Gm比Activated/MP需要更多时间.)
compiler-construction visual-studio-2010 compiler-options visual-studio visual-c++
我想将静态类函数绑定到lua.如您所知,静态类函数与类函数有所不同.所以lua中的函数调用代码应该是这样的......
//C++
lua_tinker::def(L, "Foo_Func", &Foo::Func);
//Lua
Foo_Func()
Run Code Online (Sandbox Code Playgroud)
但我想像这样在lua中调用函数
//Lua
Foo.Func()
Run Code Online (Sandbox Code Playgroud)
有没有办法像这样使用?Lua表可能会有所帮助.但我找不到任何参考资料.
现在我尝试使用boost bind&mem_fn
.但是绑定重载函数存在问题.如何解决以下代码的编译错误?
boost::function< void( IF_MAP::iterator ) > bmf = std::mem_fun1< void, IF_MAP, IF_MAP::iterator >( &IF_MAP::erase );
boost::function< void( IF_MAP::iterator ) > bmf = boost::mem_fn< void, IF_MAP, IF_MAP::iterator >( &IF_MAP::erase );
Run Code Online (Sandbox Code Playgroud)
主要目的是编制以下代码
IF_MAP M;
boost::function< void( IF_MAP::iterator ) > bmf = boost::bind(
boost::mem_fn< void, IF_MAP, IF_MAP::iterator >( &IF_MAP::erase ),
&M, _1 );
M.insert( IF_MAP::value_type( 1, 1.f ) ); M.insert( IF_MAP::value_type( 2, 2.f ) );
bmf( 2 );
Run Code Online (Sandbox Code Playgroud)
编译错误消息是这样的......
错误C2665:'boost :: mem_fn':2个重载中没有一个可以转换所有的参数类型可能是'boost :: _ mfi :: mf1 boost :: mem_fn …
class Foo
{
friend class SquirrelVM;
public:
Foo() { cout << "Ctor" << endl; }
virtual ~Foo() { cout << "Dtor" << endl; }
Foo(const Foo & o) { cout << "const Ctor" << endl; }
template <typename _ty>
Foo(const _ty & val) { cout << "T const Ref" << endl; }
template <typename _ty>
Foo(_ty & val) { cout << "T Ref" << endl; }
template <typename _ty>
Foo(_ty * val) { cout << "T Ptr" << endl; } …
Run Code Online (Sandbox Code Playgroud)