🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #770

List problem

#770
From: Rijvordt EGK
Date: Tue, 06 Oct 1992 10:19
40 lines
1524 bytes
    Hi,

I'm having some problems using the List class in InterViews 3.1 beta3.
In IV3.0 the following worked fine (simplified example):

 1  class Block
 2  {
 3      public:
 4          int f();
 5      private:
 6          int n;
 7  };
 8
 9  declareList(BlockList,Block*);
10  implementList(BlockList,Block*);


But with IV3.1 the compiler (Sun CC 2.1) complains with the following
message:

... line 10: error: no standard conversion of  const struct Block * to  
                    struct Block *

Probably because the insert function of List is declared to accept
a const T&, which in the body of insert is put in the array of T&'s 
(which are non-const).

An ugly workaround is to define the list like this:
    declareList(BlockList,const Block*);
    implementList(BlockList,const Block*);
And to cast the const away from list->item(i) whenever needed.
This also produces some (6) warnings of "two const declarators",
like in BlockList::insert( long, const const Block * ).

Is this a bug in List or am I missing something?

Thanks for any help on this matter.

                                -Edwin (erijvor@cs.vu.nl)
Technical Details
Message-ID: <Bvp3CL.MtM@cs.vu.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!doc.ic.ac.uk!uknet!mcsun!sun4nl!star.cs.vu.nl!erijvor

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!doc.ic.ac.uk!uknet!mcsun!sun4nl!star.cs.vu.nl!erijvor
From: erijvor@cs.vu.nl (Rijvordt EGK)
Newsgroups: comp.windows.interviews
Subject: List problem
Message-ID: <Bvp3CL.MtM@cs.vu.nl>
Date: 6 Oct 92 10:19:33 GMT
Sender: news@cs.vu.nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Lines: 40