Stl vector<bool>

I’m trying to use a stl vector of bools within root, but I keep getting weird problems. This is what I try:

root [0] #include <vector>; root [1] #pragma link C++ class vector <const bool>; root [2] vector<bool>res; root [3] res.push_back(1) Error: Function uninitialized_copy(begin(),position,tmp) is not defined in current scope FILE:_vector.h LINE:221 Possible candidates are... filename line:size busy function type and name *** Interpreter error recovered ***

I can do the same thing with vector and it works. Is there something I’m missing? I tried with both 3.10/02 and 4.00/08



The cintdlls (make cintdlls) generate the dictionary for some of the instantiation of STL containers (including vector). Currently
vector is not amongst this list.

root [1] #pragma link C++ class vector <const bool>; The pragma link are only usefull when generating dictionary (i.e. when running rootcint). On the command line there are nop.

To easily try to generate the dictioanry for vector or vector create a a file loader.C:#include <vector> #ifdef __MAKECINT__ #pragma link C++ class vector<const bool>; #pragma link C++ class vector<bool>; #endifand load it via ACLiCroot[] .L Loader.C+

However, note that vector is technically not a proper C++ standard container; it behaves differently from the other containers in subtle ways. See your favorites C++ references for more details. In general it is better to use a vector or vector unless you really understand why you choose the vector instead.