bobobobo
bobobobo

Reputation: 67276

I can't track down the possible copy construction bug

I have an issue where some members of a class, from one pointer, are identical (as they should be) but from another pointer they are different. This probably means a copy construction took place somewhere, but I'm not sure/ I can't find it. I already added an error/break point in what would be the copy construction routine (previously undefined)

class Foo
{
    Foo( const Foo& foo )
    {
        error( "Copying a foo: not allowed" ) ;
    }
};

The break point never gets hit.

I'm using VS 2010. How can I track this bug?

Upvotes: 0

Views: 103

Answers (1)

Tony The Lion
Tony The Lion

Reputation: 63250

To make your classes non-copyable I suggest you use boost::noncopyable to make them so, and then you'll be sure that copy construction won't be allowed. If it does accidentally happen, your compiler will tell you somethings up.

Upvotes: 2

Related Questions