Article View: gnu.g++.help
Article #172type conversion required
From: Mark Kuzmycz, SD 128, 2881
Date: Wed, 02 Sep 1992 07:14
Date: Wed, 02 Sep 1992 07:14
83 lines
1859 bytes
1859 bytes
I have the following compiler message::
/usr/local/gnu/g++ -O -I ../Include/ -target sun4 -c test.C
test.C: In function `int main ()':
test.C:68: type conversion required for type `List<Set>'
*** Error code 1
Is this a compiler bug or am I doing something wrong?? The code is...
include "list.h"
#include "set.h"
#include <iostream.h>
#include "../Utilities/list.C"
ostream& operator <<(ostream& os, List<Set>& list)
{
for(int i=0; i < list.size(); i++)
{
os << "< ";
for(int j = 0; j < list[i].maxSize(); j++)
{
if(list[i] == j)
{
os << " " << (char)('A'+j) << " ";
}
else
{
os << "~" << (char)('A'+j) << " ";
}
}
os << ">";
os <<"\n";
}
return(os);
}
int power(int number)
{
int value = 1;
for(int i =0; i < number; i++)
{
value *= 2;
}
return(value);
}
main()
{
int size;
cout << "Enter size:" << flush;
cin >> size;
int number = power(size);
Set base(size);
int index = 0;
List<Set> list;
list.add(base);
for(int i=1; i < number; i++)
{
while(base == index)
{
base -= index;
index++;
}
base += index;
cout << base;
index = 0;
list.add(base);
}
cout << list; // line # 68....
}
As you can see I have a List<Set> output operator so why does it want to cast?
Mark.
Technical Details
Message-ID:
<181pkoINNds4@sol.deakin.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!sol.deakin.OZ.AU!legolas!renagadeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!sol.deakin.OZ.AU!legolas!renagade From: renagade@legolas.deakin.oz.au (Mark Kuzmycz, SD 128, 2881) Newsgroups: gnu.g++.help Subject: type conversion required Date: 2 Sep 1992 07:14:32 GMT Organization: Sun Microsystems, Inc. Lines: 83 Distribution: world Message-ID: <181pkoINNds4@sol.deakin.OZ.AU> Reply-To: renagade@legolas.deakin.oz.au NNTP-Posting-Host: legolas.cm.deakin.oz.au