[ROOT] including libraries, specifically <string>

From: Justin Findlay (findlay@cosmic.utah.edu)
Date: Mon Apr 14 2003 - 23:22:09 MEST


Hi,

I have encountered a few scripting vexations probably having to do with
cint.  The first one is this.  It's nice to have a header filled with of
useful "TString" and "TCut" definitions that multiple script files can
refer to.

{
#include <string>
#include "/home/.../MyDefinitions.h"

using namespace std;
...

This will always return a segmentation fault, but if I switch the loading 
order it will not.

{
#include "/home/.../MyDefinitions.h"
#include <string>

using namespace std;
...


When I include the <string> header from the standard namespace and then 
issue a call to create a file object, interactive root quits without 
interface or complaint as if the '.q' command had also been issued.

TFile * file = new TFile( my_file_path.c_str(), "read" );
  or
TFile * file = new TFile( "/home/.../my_file.root", "read" );

Excluding the <string> include statement, cint will not close when a TFile
declaration statement is executed, but then I can't use strings, assuming
that "string" offers functionality above that of "TString".  Perhaps the
<string> library is loaded already by cint.


It would be nice if there were a "TSstream" class that had all of the
"sstream" stream methods defined for "TString" class objects.  As it is I
have tried to use "sstream" stream methods for "std::string" objects and
cint tells me that "sstream" operators are not defined for "std::string"  
objects.


Justin



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET