Closed Duskhorn closed 1 year ago
I require help in this template error landscape
In file included from /usr/include/c++/10.2/string:48,
from /home/dusk/projects/libprimis/src/engine/../libprimis-headers/cube.h:27,
from /home/dusk/projects/libprimis/src/engine/model/animmodel.cpp:10:
/usr/include/c++/10.2/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = animmodel::shaderparams]':
/usr/include/c++/10.2/bits/stl_map.h:499:32: required from 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = animmodel::shaderparams; _Tp = animmodel::ShaderParamsKey; _Compare = std::less<animmodel::shaderparams>; _Alloc = std::allocator<std::pair<const animmodel::shaderparams, animmodel::ShaderParamsKey> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = animmodel::ShaderParamsKey; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = animmodel::shaderparams]'
/home/dusk/projects/libprimis/src/engine/model/animmodel.cpp:204:39: required from here
/usr/include/c++/10.2/bits/stl_function.h:386:20: error: no match for 'operator<' (operand types are 'const animmodel::shaderparams' and 'const animmodel::shaderparams')
386 | { return __x < __y; }
| ~~~~^~~~~
You need a comparison operator because map
is a binary search tree. Since there is no particularly good logical fit for operator<
with shaderparams
you probably want to use an unordered_map
.
Given the fact that a lot has happened since I last worked on this and I can't keep track of the stuff to fix I'm gonna close this PR in favor of a newer one
I'll add this just to keep track for now, rn I have some painful template errors and I don't understand what it wants from me