Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
:-) note the fmt::join up there is IMHO canonical in the 21rst century..
Know your STL and get rid of those for loops.
YEEEAAHHHHHH this one is excellent!!!
For F... Sake YOU SURE KNOW YOUR STL!!
As for me... I'm tired of typing "fmt/ranges" as well as "rangeV3/anyalgo" ... when using format or ranges or views... Keep to C++17
We need a C++20 compilant compiler there !!
Finally, the universal C++ solution after 16 months of the original kumite. (15 months since my C++ translation.)
Great explanation right there.
That's much better!
Ideally, you would want to minimize memory allocations and temporary strings. The previous version would make a new string and do a string concatenation on each loop iteration. There's definitely extra work there that could be removed.
This version reserves memory ahead of time so there's never more than one memory allocation as the string grows. It also eliminates temporary string objects. Each call to push_back() is only copying a char. Also note the single quotes on the second push_back(). That indicates it's a single char ' ' instead of char array { ' ', '\0' }.
I also added a reference for the input parameter. You don't need a deep copy of the input and it's generally inadvisable to pass in containers by value since a deep copy could be expensive.
Good explanation! I like the mention of how you can just use using std:: without having to worry about any issues.
Yes, but it's generally viewed as bad practice because of namespace pollution (everything inside the
std
namespace gets inside the global namespace, and that leads to all sorts of problems), and I personally prefer to be explicit and just manually type the namespace.As an alternative that won't polute the global namespace, you can use
using std::something;
, it does the same thing, but only to the objects you specify.u can use "using namespace std"... i have no words
ah alright, me neither, learning a bit of SDL with c++ at the moment
I'm not very experienced with c++, but I think that can be done with templates, or function overloads.
Yeah, I should figure out how to get it to do multiple data types.