octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

oct-strstream.h


From: CdeMills
Subject: oct-strstream.h
Date: Fri, 23 Mar 2012 09:27:07 -0700 (PDT)

Hello,

I would like, in file-io.cc, when called with a cellstr array, to only
create the stream once. To do that, I would like to do:

const Cell argsc = args(0).cell_value ();
octave_stream os = octave_istrstream::create ("");

for (octave_idx_type i = 0; i < ns; i++)
                {  
                  data = get_sscanf_data (argsc(i));
              
                  if (! error_state)
                    {
                      os.input_stream ()->str (data);
                      retval(i) = os.oscanf (args(1), who);

but member function os.input_stream () is defined in oct-strstream.h as
 std::istream *input_stream (void) { return &is; }

yet is is defined as std::istringstream is;

The issue is that the str method is defined for std::istringstream, but not
for std::istream. Is there a reason for input_stream to return a
std::istream ?

This can be circumvented by rewritting the line as 
(static_cast<std::istringstream *> (os.input_stream ()))->str (data);

but it is not elegant ...

Regards

Pascal

--
View this message in context: 
http://octave.1599824.n4.nabble.com/oct-strstream-h-tp4499327p4499327.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]