c++ - Opt-out of copy constructor -


this might silly question, but...

i've been writing number of classes utilize non-copyable members. these classes never initialized via copy constructor in source. when try compile without supplying own copy-constructor, g++ throws out many errors how can't build default copy constructor, due non-copyable member objects.

is there way tell compiler not give me copy constructor?

edit: yeah... feels silly... had case invoking copy-constructor accident in boost::bind call. lesson learned.

if don't cause copy-constructor called not error if compiler unable generate one. sounds (possibly indirectly) causing copy-constructor used.

you can suppress compiler generated 1 declaring own copy-constructor (you don't need define if you're not using it). can place in private section of class.

if changes error copy-constructor inaccessible or link errors causing copy-construtor used , need analyze why is.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -