Skip to main content
added 124 characters in body; added 22 characters in body
Source Link
J. Polfer
  • 12.6k
  • 10
  • 57
  • 84

This might be a silly question, but...

I've been writing a number of classes that utilize non-copyable members. These classes are never initialized via the copy constructor in my source. When I try to compile without supplying my own copy-constructor, g++ throws out many errors about how it can't build a default copy constructor, due to the non-copyable member objects.

Is there a way to tell the compiler to just not give me a copy constructor?

EDIT: Yeah... feels silly... I had a case where I was invoking the copy-constructor by accident in a boost::bind call. Lesson learned.

This might be a silly question, but...

I've been writing a number of classes that utilize non-copyable members. These classes are never initialized via the copy constructor in my source. When I try to compile without supplying my own copy-constructor, g++ throws out many errors about how it can't build a default copy constructor, due to the non-copyable member objects.

Is there a way to tell the compiler to just not give me a copy constructor?

This might be a silly question, but...

I've been writing a number of classes that utilize non-copyable members. These classes are never initialized via the copy constructor in my source. When I try to compile without supplying my own copy-constructor, g++ throws out many errors about how it can't build a default copy constructor, due to the non-copyable member objects.

Is there a way to tell the compiler to just not give me a copy constructor?

EDIT: Yeah... feels silly... I had a case where I was invoking the copy-constructor by accident in a boost::bind call. Lesson learned.

Source Link
J. Polfer
  • 12.6k
  • 10
  • 57
  • 84

Opt-out of copy constructor

This might be a silly question, but...

I've been writing a number of classes that utilize non-copyable members. These classes are never initialized via the copy constructor in my source. When I try to compile without supplying my own copy-constructor, g++ throws out many errors about how it can't build a default copy constructor, due to the non-copyable member objects.

Is there a way to tell the compiler to just not give me a copy constructor?