#Fix the warnings
Fix the warnings
235745.cpp: In member function ‘variable Function::operator()(variableList&&)’:
235745.cpp:43:49: warning: value computed is not used [-Wunused-value]
43 | if ((indexes[0] & 0x80) ? i.index() != (indexes[0] & 0x03), idx++ : i.index() != indexes[idx++])
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
235745.cpp:43:91: warning: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type’ {aka ‘int’} [-Wsign-compare]
43 | if ((indexes[0] & 0x80) ? i.index() != (indexes[0] & 0x03), idx++ : i.index() != indexes[idx++])
It looks like the first of those is reporting a serious error; perhaps that line was supposed to be:
if ((indexes[0] & 0x80) ? ++idx, i.index() != (indexes[0] & 0x03) : i.index() != indexes[idx++])
Or just start idx at -1, and increment it immediately before the if instead.
Magic numbers
#Magic numbers
There'sThere's a sprinkling of 0x80 and 0x3 around the code with no explanation. I'd expect those to be named constants.
Default promotions and default arguments.
#Default promotions and default arguments.
ThisThis seems much more restrictive than standard function calls, where (for example) int arguments can be promoted for functions expecting double. Is that intentional? It's certainly surprising.
Similarly, it's disappointing that we can't use default arguments as we can in ordinary C++ functions.
Formatting
#Formatting PleasePlease don't do this - it's really hard to read:
std::string fname; std::vector<int> indexes; std::function<variable(variableList &&)> fn;