Closed RafaelAmauri closed 10 months ago
Can you check if this code is still working? I needed to find a working implementation of Tarjan's algorithm, but the build command does not work.
Linux - Arch Linux 6.1.62-1-lts g++ (GCC) 13.2.1 20230801 glibc 2.38-7
The error I'm getting:
cmake --build build/ [ 4%] Building CXX object source/arbok/CMakeFiles/arbok.dir/src/data_structures/dsu.cpp.o [ 9%] Building CXX object source/arbok/CMakeFiles/arbok.dir/src/data_structures/treap.cpp.o /home/rafael/PUC/PUC-Minas/ll/arbok/source/arbok/src/data_structures/treap.cpp: In function ‘void arbok::treap::update(Node*)’: /home/rafael/PUC/PUC-Minas/ll/arbok/source/arbok/src/data_structures/treap.cpp:18:35: error: no matching function for call to ‘min(<brace-enclosed initializer list>)’ 18 | void update(Node *v) { v->mn = min({mn(v->l), v->x, mn(v->r)}); } | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13.2.1/vector:62, from /home/rafael/PUC/PUC-Minas/ll/arbok/source/arbok/include/arbok/data_structures/treap.h:5, from /home/rafael/PUC/PUC-Minas/ll/arbok/source/arbok/src/data_structures/treap.cpp:2: /usr/include/c++/13.2.1/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13.2.1/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: /home/rafael/PUC/PUC-Minas/ll/arbok/source/arbok/src/data_structures/treap.cpp:18:35: note: candidate expects 2 arguments, 1 provided 18 | void update(Node *v) { v->mn = min({mn(v->l), v->x, mn(v->r)}); } | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13.2.1/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13.2.1/bits/stl_algobase.h:281:5: note: template argument deduction/substitution failed: /home/rafael/PUC/PUC-Minas/ll/arbok/source/arbok/src/data_structures/treap.cpp:18:35: note: candidate expects 3 arguments, 1 provided 18 | void update(Node *v) { v->mn = min({mn(v->l), v->x, mn(v->r)}); } | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [source/arbok/CMakeFiles/arbok.dir/build.make:90: source/arbok/CMakeFiles/arbok.dir/src/data_structures/treap.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:191: source/arbok/CMakeFiles/arbok.dir/all] Error 2 make: *** [Makefile:101: all] Error 2
Apparently newer versions of GCC removed some undocumented transitive includes in std headers. I added the missing includes to our code and it should build now. Thanks for the hint :)
Can you check if this code is still working? I needed to find a working implementation of Tarjan's algorithm, but the build command does not work.
Linux - Arch Linux 6.1.62-1-lts g++ (GCC) 13.2.1 20230801 glibc 2.38-7
The error I'm getting: