P
Patrick Kowalzick
Hello all,
find below an example which IMO should refuse to compile. It compiles fine
with VS2005.
What happens in the call?
What is your opinion?
Kind regards,
Patrick
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private:
// hide the copy-ctor and assignment
noncopyable( noncopyable const & );
const noncopyable& operator=( noncopyable const & );
};
class A : public noncopyable // inherit to avoid copying
{
noncopyable copy_protection; // make member to avoid copying
};
int main()
{
//A a;
//A b = a; // this fails to compile
A c = A(); // this compiles fine
return 0;
}
find below an example which IMO should refuse to compile. It compiles fine
with VS2005.
What happens in the call?
What is your opinion?
Kind regards,
Patrick
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private:
// hide the copy-ctor and assignment
noncopyable( noncopyable const & );
const noncopyable& operator=( noncopyable const & );
};
class A : public noncopyable // inherit to avoid copying
{
noncopyable copy_protection; // make member to avoid copying
};
int main()
{
//A a;
//A b = a; // this fails to compile
A c = A(); // this compiles fine
return 0;
}