|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-02-04 13:44:35
>From: "Paul A. Bristow" <boost_at_[hidden]>
> This looks most useful - potentionally :-(
>
> Alas the two files, test and composite_stream_operators.hpp
>
> http://groups.yahoo.com/group/boost/files/composite_stream_operators/).
>
> won't compile on MSVC 7.0.
>
> test_composite_format.cpp
> test_composite_format.cpp(43) : error C2679: binary '<<' : no operator
found
> which takes a right-hand operand of type 'composite_format<T>' (or there
is no
> acceptable conversion)
> with
> [
> T=char (&)[3]
> ]
>
> and similarly for T=Map
>
> Is the cause/workaround obvious?
Looking at the error messages, and from what I've heard, it may be that it
has problems with template friends (which is what the operator<< is). If
that's the case, the workaround should be very easy - making it a
free-function template.
I did that, now, and it works. :)
At least the vector_pair_test(). The array2D_test() uses a little fancy
code, such as passing the type reference to array as a template parameter,
and it seems MSVC 7.0 has some problems with this. Anyway, that was just to
demonstrate usage with built-in types, as well, such as arrays. I'll look
into it.
There wasn't really any need for it to be a friend function, as it didn't
access any private parts. It was just defined inside the class for
convenience.
I've also tested it on Intel C++ 7.0 in strict mode and g++ 3.2, so the code
should be conformant, at least.
Thanks for the report. I hadn't yet got around to do more portability
testing, but intend to do that, including writing more tests for it. I've
updated the version at Yahoo Groups with the above changes.
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk