Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-06-13 12:58:43


As the library implemenation is based on templates, there is no need to
specify all types. Any type not specifically mentioned, is checked to see
if its a prmitive, ie int, long etc. If so, there is code to handle it.
This is almost necessary because every platform has different types for
things like 64 bit integers, etc.

Note that std::string is special in that it is treated as a primitive. This
is the only such special case.

ar << rhs

will not work for all right hand sides. If rhs is the return from a
function call, then it is a temporary variable with only a temporary
address. In such a case, ask yourself what ar >> rhs would mean? If rhs is
a function call returning a reference to a const obect the above will work -
but you might have to do some tweaking wiht ar >> rhs.

Robert Ramey

Marcin Tustin wrote:
> I'm using the CVS version of Boost from 2005-06-06, and it seems
> that text archives don't support anything except strings, characters,
> and the like, specifically not integer types like int. I've grepped
> the archive includes, and it seems that there are no save methods
> specified for the integer types (except char) by the text archives,
> and I get compiler errors like:
> c:\D2\API\NewClient\EnhancedMessageHandler.h(370) : error C2679:
> binary '<<' : no operator found which takes a right-hand operand of
> type 'int' (or there is no acceptable conversion)
>
> (with VC7.1)
>
> It works when the RHS of << is a variable, but not when it is a
> function. I take it that this is because with variables, a string is
> automatically constructed to wrap the int types. This is very
> confusing, and might well be worth mentioning in the docs.
>
> Marcin Tustin
> IT Innovation Centre
> 2 Venture Road
> Chilworth Science Park
> Southampton, SO16 7NP, UK
>
> tel: +44 23 8076 0834
> fax: +44 23 8076 0833
>
> mailto:mt_at_[hidden]
> http://www.it-innovation.soton.ac.uk


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net