how/where to initialize a static private std::list member ?
umesh_at_dani
0
Newbie Poster
Recommended Answers
Jump to PostWhere: in the source file (not in the header file).
How: like this:// in my_class.h: #include <list> class MyClass { private: static std::list<int> privateList; }; // in my_class.cpp: #include "my_class.h" std::list<int> MyClass::privateList = std::list<int>();
Or with whatever else you want to initialize it with.
All 2 Replies
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.