xpol/lua-rapidjson

The compiler report can not copy the Value object.

watsonsong opened this issue · 1 comments

The code in values.cpp file:
`
Value ArrayValue(lua_State* L, int idx, int depth, Allocator& allocator)
{
Value array(rapidjson::kArrayType);
int MAX = static_cast(luax::rawlen(L, idx)); // luax::rawlen always returns size_t (>= 0)
for (int n = 1; n <= MAX; ++n)
{
lua_rawgeti(L, idx, n); // [table, element]
array.PushBack(toValue(L, -1, depth, allocator), allocator);
lua_pop(L, 1); // [table]
}
// [table]

return array;

}
`

Return the array means invoke the copy constructor for GenericValue, but it mark as private in rapidjson.

I find must add the target_compile_features(lua-rapidjson PRIVATE cxx_rvalue_references) to the cmake, but when I compile to the ios platform, it failed:
target_compile_features no known features for CXX compiler "Clang"

I think the source code should be work on any compiler without specify compile flags~

xpol commented

I have switch to osx for travis build, it builds well.

Check your compiler version and you need to enable C++0x or C++11.