3 ms·
A decent C++ compiler will also inline the sorting for something like: constexpr size_t N = 3; void sort_N(std::array<int, N> a){ std::sort(st
by patrec 7y ago
A decent C++ compiler will also inline the sorting for something like:
constexpr size_t N = 3;
void sort_N(std::array<int, N> a){
std::sort(std::begin(a), std::end(a));
}
but I haven't checked if it does the same with qsort. But I agree with your larger point; I find the efficiency claims for C++ frequently overblown and the compile time burden substantial (OTOH it's still very hard, but slightly easier to write robust code in C++ compared to C).