G
Gunnar
Hello.
The (stupid) code below does not compile with the message
In method `istream::istream(const istream &)':
/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/streambuf.h:128:
`ios::ios(const ios &)' is private
Silly.cpp:15: within this context
It's the function call to "foo" that does not work. My question is, what is
it exactly that makes the compiler (g++ 2.95.4) fail on this?
In the above mentioned file it says:
class ios : public _ios_fields {
ios& operator=(ios&); /* Not allowed! */
ios (const ios&); /* Not allowed! */
What does this mean? The assignment operator and CC is not allowed, but how
can I see that??
(It works fine if I use void foo(ifstream& fil) instead).
-------------------------------------
#include <fstream>
#include <iostream>
using namespace std;
void foo(ifstream fil){
fil.close();
}
int main(){
ifstream fil;
fil.open("hihi");
if (fil.is_open())
cout<<"File open"<<endl;
foo(fil);
if (fil.is_open())
cout<<"File open"<<endl;
}
The (stupid) code below does not compile with the message
In method `istream::istream(const istream &)':
/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/streambuf.h:128:
`ios::ios(const ios &)' is private
Silly.cpp:15: within this context
It's the function call to "foo" that does not work. My question is, what is
it exactly that makes the compiler (g++ 2.95.4) fail on this?
In the above mentioned file it says:
class ios : public _ios_fields {
ios& operator=(ios&); /* Not allowed! */
ios (const ios&); /* Not allowed! */
What does this mean? The assignment operator and CC is not allowed, but how
can I see that??
(It works fine if I use void foo(ifstream& fil) instead).
-------------------------------------
#include <fstream>
#include <iostream>
using namespace std;
void foo(ifstream fil){
fil.close();
}
int main(){
ifstream fil;
fil.open("hihi");
if (fil.is_open())
cout<<"File open"<<endl;
foo(fil);
if (fil.is_open())
cout<<"File open"<<endl;
}