OK, for that particular example:
- you can get the time services from the standard library here
- you can use eigen for linear algebra. It's an amazing library, I'm in love with it.
- check here to learn how to manipulate files
While using C++, you might miss some features from python, but most of them are actually provided by the boost libraries. For instance returning multiple values from a function is very easy with boost.tuple library as in here. You can use boost::shared_ptr if you don't want to bother yourself with memory management. Or if you want to keep using python to play with your c++ classes, you can use boost.python. Boost.parameter helps you define functions with named arguments. There is also Boost.lambda for lambda functions, but if your environment supports it, you can also use C++11 to have language support for lambda functions. Boost is a gold mine, never stop digging. Just assume that it's part of the standard library. I develop C++ in many different platforms, and neither eigen nor boost has let me down yet.
Here's a good FAQ for C++ best practices. This is a very important principle that you have to keep in mind at all times, while working in C++. I extend it a bit, in my mind and think; If you're going to do something dangerous such as: Allocate memory with a raw new
, or index a raw C style array, pass around raw pointers, or do static_cast
(even worse reinterpret_cast
) etc. They should usually happen in a class somehow dedicated to them, and the code to make sure they don't cause trouble lives very close to them, so that you can see at a glance that everything is under control.
Finally, my favourite!!! Do you want to keep using generators in C++? Here's some dark magic.