P1883 (LLFIO) review
std::filesystem brought in a nice set of features to C++’s standard library in 2017 and it became much easier to write cross platform code that deals with paths. Long gone are those days when for Linux you had to use / as path separator and on Windows the opposite .
While working strictly with paths has become easier and you can pretty much ignore the peculiarities of different systems, you actually can’t escape from specific platform code when you start to use the files that those paths reffer to.
std::any aka variable variables
While std::any is not a new addition to the standard library, it was added back in 2017, I only started to take advantage of it from like a year ago, mostly because I was solving other time consuming problems and refactoring old code was not among the priorities at the time.
Before we dive in, you can find the complete code in my repository.
So what is std::any? According to cppreference:
Simple Rules for Safer Programs
I’m sure everybody hates it when some obscure bug happens which then consumes precious development time in the attempt to fix. It happens to the best of us.
To keep these at a minimum I employ some simple rules or guidelines and you should do it too if you value your time.
Prefer references instead of raw pointers A reference can’t be null like a pointer and you don’t have to check it if it’s non-null before using it.