How to write vector<bool> into root file

Hello,

I would like to write vector into Root file using following piece of code:
vector vBool;
vector * pBool = &vBool;
tree->Branch(“pBool”, “vector”, &pBool);

The code compiles and runs. Unfortunately when I look into the Root file with TBrowser I do not see corresponding branch pBool.

The same type of code works just fine for vector:
vector vInt;
vector * pInt = &vInt;
tree->Branch(“pInt”, “vector”, &pInt);

Different behavior for vector and vector seams strange. Is it expected? Or am I doing something wrong? Any help (or example) will be appreciated.

Hi,

We do not provide a precompiled dictionary for vector, you will need to generate one explicitly (using ACLiC).

Cheers,
Philippe.

Philippe, thanks for hint.

I added following lines (like in hvector.C):

#ifdef __MAKECINT__ #pragma link C++ class vector<bool>; #endif and now my script is working fine.

Then I decided to make compiled executable and found out that above solution works only in CINT. But I found another thread on this issue http://root.cern.ch/phpBB2/viewtopic.php?t=8467. Following this thread I added following lines in my program:

#include "TROOT.h" gROOT->ProcessLine("#include <vector>"); Now it compiles and stores vector into Root file.