RE: [ROOT] string streams

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Jun 06 2003 - 22:58:08 MEST


Hi Justin,

You are most likely using a distribution where the dictionary for
std::string has not been built and/or not loaded yet.  You would need to do:
	cd $ROOTSYS;
	gmake cintdlls
and make sure to do (sometimes in the session):
	#include <string>

Cheers,
Philippe


-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Justin Findlay
Sent: Thursday, May 29, 2003 7:57 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] string streams


Hi,

I would like to know how one can use stringstream objects.  If I do this,


{
#include <string>
#include <sstream>

using namespace std;

int    i = 1;
double d = 1.1;
string s = "asdf";
ostringstream osstr;

osstr << i << " " << d << " " << s << endl;
}


then I get


Error: operator<< not defined for basic_ostream<char,char_traits<char> >
FILE:sstream.cpp LINE:12


Of course, this is just a CINT limitation, but it would be very useful to
create a TSstream class which can concatinate and extract ROOT strings
like C++ strings.  It seems the only way one can use sstream functionality
now is by stringing characters into a C++ string and converting it into a
ROOT TString or TCut object at the last step (assuming the code has been
compiled and correctly linked against sstream).  As it is now I am using
sprintf() with its obvious static limitations.


Justin



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