title: Large static data member, inheritance, and performance
body: <p>I'm not too sure how to ask this question. I need to store a ton of data into a vector at the beginning of the program, but only once. I tried putting that vector, <code>my_vect</code>, inside a constructor in a base class to load all the data into it, but the problem is, that data needs to be used by the derived classes that will be created throughout the program.</p>
  
  <p>Essentially (unless I took a totally different approach?) the vector needs to be static because I don't want to have to reload the data into the vector every time a child class is created. Can I somehow create this <code>my_vect</code> globally to avoid this static singleton stuff? I also need to be able to iterate through <code>my_vect</code> extremely fast in my derived classes. Is putting <code>extern</code> in every file a good choice? Please forgive me for any convoluted-ness, and say if you need any clarification.</p>
  
  <p>EDIT:</p>
  
  <p>Heres the jist of my program. I have a vector that reads thousands of lines from text file and stores them by words. No prob. I need to do that at the start of my program and I only want to store them once. After they are stored, every class I have needs to have fast <code>my_vect[incr]</code> access to the vector. I tried putting that vector as <code>protected</code> inside a base class so its initialized from the start, but the problem was that every time a new derived class object is created it would be loading all the data into the vector again. I only want the vector to be stored once, and used everywhere. Maybe singletons arn't the way to go?</p>