DEV Community

Discussion on: Best practices for reversing a string in JavaScript, C++ & Python

Collapse
 
sandordargo profile image
Sandor Dargo

Thanks for the article.

#include<bits/stdc++.h> should not be used. Not because it is OS specific, it might be, I'm not sure. But it is basically a header that includes all the headers of the standard library.

Given that #inlucde in C++ means basically a textual copy-paste, it's not just unnecessary to include the above header, but it will bloat your binary size without any reason.

Include what you need and that is <algorithm> as Swastik Baranwal pointed out.

As the most important reason to use C++ is still performance, I'd be happy to see a comparison among the different ways to reverse a string.