mercredi 24 décembre 2014

c++11 forwarddeclare thread,mutex,chrono

I am aware that we should prefer to forward declare everything in header files, if possible but what about STL?


I have found that for iostream there is iosfwd.


What if i want to have a mutex declared in my class, like this:



class MyClass
{

.....
private:
std::mutex mMutex;
};


Should I include mutex header in my class header? Or is there way to forwarddeclare it, like:



class std::mutex;
class MyClass{...};


Same goes for chrono, and thread as well.


Any thoughts on that is appreacited. Thanks!


Aucun commentaire:

Enregistrer un commentaire