|
Boost Users : |
From: Hickman, Greg (greg.hickman_at_[hidden])
Date: 2002-11-04 14:21:46
> -----Original Message-----
> From: Mark Storer [mailto:mstorer_at_[hidden]]
>
> You wrote up your sample so anyone could easily compile it...
Thanks for noticing. :)
> On
> VC++ v6, I got two compiler errors:
>
> samplecode.cpp(58) : error C2663: 'reset' : 2 overloads have
> no legal conversion for 'this' pointer
> samplecode.cpp(59) : error C2678: binary '=' : no operator
> defined which takes a left-hand operand of type 'const class
> boost::shared_ptr<struct Shape const >' (or there is no
> acceptable conversion)
>
> These errors are on the two lines you want to prevent.
>
> My first impression of the code was that it was already
> illegal to perform those two actions. You shouldn't be able
> to call non-const functions through a const_iterator, and
> since neither reset() nor operator=() are const, no problem.
> Right? I wasn't expecting the first error message, but the
> second is in line with my expectations.
>
> I take it this code compiles for you? What tools/OS/etc are
> you using?
Unfortunately it does. I'm using Borland C++ Builder 5, for which I believe
I have all of the available patches installed. (I'm using the IDE, but my
command-line tells me I'm using Borland C++ 5.5.1. Borland gives away a set
of free command-line tools that are distinct from the Builder IDE, and it
may be that the compiler they give away is now more compliant than the one
included in C++ Builder 5. If there is a way to point my IDE at the latest
version of the free compiler, I don't know how to do it. I need to get gcc
set up on my machine as a sanity check.)
My first thought was that iterator_adaptor might be stripping away the
const-ness from reference_type<const Const_shape_ptr>, and that the pointer
type being generated was somehow pointing to a non-const Const_shape_ptr,
thus allowing the indicated lines to compile. However, since you seem to
get the desired results, perhaps the problem is with my compiler (or with
Boost's support of it).
Thanks very much for taking the time to respond.
-Greg Hickman
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