UDLua
UDLua copied to clipboard
Does not compile (Does compile after some tweaking)
俺C++也就搬砖工水平,不太能确定这个是不是正常现象,如果这个issue显得比较蠢求轻拍(
OS: Linux Mint 20.1 x86_64 Compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 UDRefl: master(8e0c18a) ULuaW: master(239b2fa)
> make
Scanning dependencies of target UDLua_core
[ 20%] Building CXX object src/core/CMakeFiles/UDLua_core.dir/UDLua.cpp.o
/home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp: In function ‘int f_meta(lua_State*)’:
/home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp:76:48: error: expected primary-expression before ‘>’ token
76 | else if (functor.type.Is<UDRefl::ObjectView>()) {
| ^
/home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp:76:50: error: expected primary-expression before ‘)’ token
76 | else if (functor.type.Is<UDRefl::ObjectView>()) {
| ^
/home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp:80:50: error: expected primary-expression before ‘>’ token
80 | else if (functor.type.Is<UDRefl::SharedObject>()) {
| ^
/home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp:80:52: error: expected primary-expression before ‘)’ token
80 | else if (functor.type.Is<UDRefl::SharedObject>()) {
| ^
In file included from /usr/include/c++/10/memory:63,
from /usr/Ubpa/ULuaW_0_1_1/include/ULuaW/LuaState.h:5,
from /usr/Ubpa/ULuaW_0_1_1/include/ULuaW/ULuaW.h:3,
from /home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/Util.h:3,
from /home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h: In instantiation of ‘constexpr _Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = Ubpa::UDRefl::MethodRange::iterator; _Predicate = __gnu_cxx::__ops::_Iter_pred<f_ObjectView_index(lua_State*)::<lambda(Ubpa::UDRefl::ObjectView, Ubpa::Name)>::<lambda(const auto:42&)> >]’:
/usr/include/c++/10/bits/stl_algo.h:3934:28: required from ‘constexpr _IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = Ubpa::UDRefl::MethodRange::iterator; _Predicate = f_ObjectView_index(lua_State*)::<lambda(Ubpa::UDRefl::ObjectView, Ubpa::Name)>::<lambda(const auto:42&)>]’
/home/ikigai/SoftData/libs/ubpa-multi/UDLua/src/core/UDLua.cpp:407:4: required from here
/usr/include/c++/10/bits/stl_algobase.h:1974:23: error: no matching function for call to ‘__find_if(Ubpa::UDRefl::MethodRange::iterator&, Ubpa::UDRefl::MethodRange::iterator&, __gnu_cxx::__ops::_Iter_pred<f_ObjectView_index(lua_State*)::<lambda(Ubpa::UDRefl::ObjectView, Ubpa::Name)>::<lambda(const auto:42&)> >&, std::__iterator_traits<Ubpa::UDRefl::MethodRange::iterator, void>::iterator_category)’
1974 | return __find_if(__first, __last, __pred,
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
1975 | std::__iterator_category(__first));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1909:5: note: candidate: ‘template<class _InputIterator, class _Predicate> constexpr _InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate, std::input_iterator_tag)’
1909 | __find_if(_InputIterator __first, _InputIterator __last,
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1909:5: note: template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_algobase.h:1975:34: note: cannot convert ‘std::__iterator_category<Ubpa::UDRefl::MethodRange::iterator>(__first)’ (type ‘std::__iterator_traits<Ubpa::UDRefl::MethodRange::iterator, void>::iterator_category’ {aka ‘std::output_iterator_tag’}) to type ‘std::input_iterator_tag’
1975 | std::__iterator_category(__first));
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1921:5: note: candidate: ‘template<class _RandomAccessIterator, class _Predicate> constexpr _RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, std::random_access_iterator_tag)’
1921 | __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1921:5: note: template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_algobase.h:1975:34: note: cannot convert ‘std::__iterator_category<Ubpa::UDRefl::MethodRange::iterator>(__first)’ (type ‘std::__iterator_traits<Ubpa::UDRefl::MethodRange::iterator, void>::iterator_category’ {aka ‘std::output_iterator_tag’}) to type ‘std::random_access_iterator_tag’
1975 | std::__iterator_category(__first));
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1972:5: note: candidate: ‘template<class _Iterator, class _Predicate> constexpr _Iterator std::__find_if(_Iterator, _Iterator, _Predicate)’
1972 | __find_if(_Iterator __first, _Iterator __last, _Predicate __pred)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1972:5: note: template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_algobase.h:1974:23: note: candidate expects 3 arguments, 4 provided
1974 | return __find_if(__first, __last, __pred,
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
1975 | std::__iterator_category(__first));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/core/CMakeFiles/UDLua_core.dir/build.make:63: src/core/CMakeFiles/UDLua_core.dir/UDLua.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:115: src/core/CMakeFiles/UDLua_core.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
My tweaks:
UDLua.cpp 76:
- else if (functor.type.Is<UDRefl::ObjectView>()) {
+ else if (functor.type.template Is<UDRefl::ObjectView>()) {
UDLua.cpp 80:
- else if (functor.type.Is<UDRefl::SharedObject>()) {
+ else if (functor.type.template Is<UDRefl::SharedObject>()) {
UDLua.cpp 405-407:
- return std::find_if(methods.begin(), methods.end(), [name](const auto& name_methodinfo) {
- return std::get<const Name>(name_methodinfo) == name;
- }) != methods.end();
+ for (auto& method : methods){
+ if (std::get<const Name>(method) == name){
+ return true;
+ }
+ }
+ return false;