The best we can get it down to is 2 moves in MSVC, it does not elide the moves/copies as well as GCC and Clang do It's not possible for us to support registering of array types in MSVC12, but we can in MSVC14 with the latest release of the compiler.
This commit is contained in:
@@ -490,8 +490,17 @@ namespace chaiscript
|
||||
std::vector<Type_Info> types = t_f->get_param_types();
|
||||
assert(types.size() == t_args.size() + 1);
|
||||
|
||||
#ifdef CHAISCRIPT_MSVC_12
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 6011)
|
||||
#endif
|
||||
// this analysis warning is invalid in MSVC12 and doesn't exist in MSVC14
|
||||
std::vector<Type_Info> retval{types[0]};
|
||||
for (size_t i = 0; i < types.size()-1; ++i)
|
||||
#ifdef CHAISCRIPT_MSVC_12
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < types.size() - 1; ++i)
|
||||
{
|
||||
if (t_args[i].get_type_info() == chaiscript::detail::Get_Type_Info<Placeholder_Object>::get())
|
||||
{
|
||||
|
@@ -162,12 +162,16 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_test_mo
|
||||
m->add(chaiscript::fun(&TestBaseType::const_val), "const_val");
|
||||
m->add(chaiscript::fun(&TestBaseType::base_only_func), "base_only_func");
|
||||
|
||||
#ifndef CHAISCRIPT_MSVC_12
|
||||
// we cannot support these in MSVC_12 because of a bug in the implementation of
|
||||
// std::reference_wrapper
|
||||
// Array types
|
||||
m->add(chaiscript::fun(&TestBaseType::mdarray), "mdarray");
|
||||
m->add(chaiscript::bootstrap::array<int[2][3][5]>("IntArray_2_3_5"));
|
||||
m->add(chaiscript::bootstrap::array<int[3][5]>("IntArray_3_5"));
|
||||
m->add(chaiscript::bootstrap::array<int[5]>("IntArray_5"));
|
||||
// end array types
|
||||
#endif
|
||||
|
||||
m->add(chaiscript::fun(&get_new_int), "get_new_int");
|
||||
|
||||
|
@@ -71,10 +71,19 @@ int main()
|
||||
|
||||
chai.eval(" { auto i = create(); } ");
|
||||
|
||||
#ifdef CHAISCRIPT_MSVC
|
||||
if (Test::destructcount() == 3 && Test::copycount() == 0 && Test::movecount() == 2 && Test::constructcount() == 1)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
} else {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#else
|
||||
if (Test::destructcount() == 2 && Test::copycount() == 0 && Test::movecount() == 1 && Test::constructcount() == 1)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
} else {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user