On 7/9/05, Brian Hechinger <[EMAIL PROTECTED]> wrote:
> On Sat, Jul 09, 2005 at 09:25:07PM +0200, Carlos Vidal wrote:
> > The message looks cryptic, but basically it says that it cannot go
> > from a non-const type to const. Try to cast the right hand side
> > operand to force both sides of the '=' to the same type, like:
> >
> > ItemList::const_reverse_iterator anchor =
> > (ItemList::const_reverse_iterator)(_items.rbegin());
> 
> that gets me:
> 
> "Menu.cc", line 1055: Error: Cannot cast from 
> std::__reverse_bi_iterator<std::list<bt::MenuItem>::iterator, 
> std::bidirectional_iterator_tag, bt::MenuItem, bt::MenuItem&, bt::MenuItem*, 
> int> to std::__reverse_bi_iterator<std::list<bt::MenuItem>::const_iterator, 
> std::bidirectional_iterator_tag, bt::MenuItem, const bt::MenuItem&, const 
> bt::MenuItem*, int>.

Change the type of the left side then ;-).  Try taking away the
constantness, like:

ItemList::reverse_iterator anchor = _items.rbegin();

Supposedly the STL should define both "const reverse_iterator begin()"
and "reverse_iterator begin()", but is hard from the compiler point of
view to tell the difference or compose the right combination of consts
inside a template code (the resulting assembler code is identical,
these distinctions are meant to "help" us, programmers ;-).

> > Check also if your compiler doesn't have a flag to relax a bit the
> > type convertion rules, Solaris' compiler seems tighter than gcc (what
> > doesn't mean it's better or worse, just different! ;-)
> 
> Solaris' compiler is extremely anal, as is IRIX's MIPSpro and VMS's DEC C.

Yeah, each in its own way! :-) This is why I love script languages so much!

Carlos

--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
List archives:  http://asgardsrealm.net/lurker/splash/index.html

Reply via email to