Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++: std::chrono or boost::chrono [closed]


I'm doing some benchmarking in my code and I'm trying to figure out if I should use the standard version of chrono or the original one provided by Boost.
I started using the standard one because I wanted to try it out, and noticed that for example it doesn't provide io functions like the chrono provided by Boost does.
So, regarding chrono and in general, should I use Boost libraries or their standard library counterparts?

like image 469
Tal Zion Avatar asked Feb 04 '14 17:02

Tal Zion


1 Answers

It depends on what do you want to achieve. C++ chrono pros:

  1. Better understandability (more users know standard library than boost)
  2. Better portability (in case you have decided to use c++11)
  3. Maybe it will work faster.
  4. Don't add additional dependencies to project.

Boost chrono pros:

  1. Works for c++03
  2. Provides more functionality.

So, if you don't need that additional io functions and don't need c++03 support, use standard library.

like image 121
Alex Telishev Avatar answered Sep 29 '22 05:09

Alex Telishev