If I wanted to count how many objects of a class I make, I could write
and then a file with the code and initializationCode:// header.hh class bob { public: bob() ; private: static int bobCount_ ; }
So here is the question. Say I want to instead add each object to a stdlib set? Then my header file isCode:// code.cc #include "header.hh" bob::bobCount_ = 0 ; bob::bob() { bobCount_++ ; }
and then a file with the code and initializationCode:// header.hh #include <set> class bob { public: bob() ; private: static std::set<bob*> bobSet ; }
So how do I initialize the set container class? The row of question marks doesn't work!Code:// code.cc #include "header.hh" bob::bobSet = ???? bob::bob() { bobSet.insert( this ) ; }
Brian



LinkBack URL
About LinkBacks


