Thread View: gnu.g++.help
1 messages
1 total messages
Started by Mark Kuzmycz, SD 128, 2881
Wed, 02 Sep 1992 07:14
type conversion required
Author: 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads