"Dirk Gerrits" <[EMAIL PROTECTED]> wrote in message aramm3$n2c$[EMAIL PROTECTED]">news:aramm3$n2c$[EMAIL PROTECTED]... > Craig Henderson wrote: > > > Hi, > > I am deriving from boost::noncopyable to prevent copying of my > > objects. When I compile in VC7 with /W4 (warning level 4), I get a > > warning C4511 - copy constructor could not be generated > > Isn't that what boost::noncopyable is supposed to do?
In an ideal world, I wouldn't expect a warning or error unless I actually tried to copy the object. > > > The documentation states that: "This warning can be caused by having a > > copy constructor for the base class that is not accessible by the > > derived class". As a result, I changed the copy ctor and assignment > > operator to be protected rather than private to make them visible to > > the derived class, and all is well. > > Won't this mean that inside the class, copying will cause a link-time > failure, and outside of it a compile-time failure? The mistake of > accidentally copying an instance inside the class itself is probably > pretty rare, but still, catching errors as early as possible is > preferable IMHO. I guess so, but I would prefer to take this minor disadvantage in return for a clean compile at warning level 4. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
