Re: 'const' again

From: Fons Rademakers (rdm@pcsalo.cern.ch)
Date: Thu Sep 03 1998 - 22:42:21 MEST


Hi Rutger,

   the problem has been fixed and the signature is now 
operator<<(const Char_t*). The way you try to use << is ok.

Cheers, Fons.

PS: operator<<(const Int_t) does not make sense since the argument is
    passed by value so cannot be changed anyway.

> 
> Hi,
> 
> Again a message about 'const' etc.
> 
> I somewhere need to stream a 'const Text_t*' into a TMessage, which is a
> TBuffer.
> 
> I have
> 
> const Text_t* name = <something>
> TMessage messOut(kMESS_OBJECT);
> 
> and would like to do:
> 
> messOut << name;
> 
> This doesn't work because the operator is defined as
> 
> TBuffer &TBuffer::operator<<(Char_t *c)
> 
> I think this should be:
> 
> TBuffer &TBuffer::operator<<(const Char_t *c
> 
> as for all the other TBuffer input (i.e. <<) operators. Or is there
> (another) reason why I should not use the << operators? (Should I use the
> WriteArray member?... ifso why are << operators public?)
> 
> Thanks,
> 
> Rutger
> 
> p.s. I'm curious to things discussed at CHEP98, will there be some
> note/report/summary? 
> 


-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET