Tag: stl
-
Why does GCC copy object for each comparison in `std::ranges::max`?
10 Consider the following example (Godbolt): #include <vector> #include <iostream> #include <ranges> #include <algorithm> struct A { A() {} A( const A& ) { std::cout << "Copyn"; } A( A&& ) noexcept { std::cout << "Moven"; } A& operator=(const A&) { std::cout << "Copy assignedn"; return *this; } A& operator=( A&& ) noexcept { std::cout…