Re: C++ question related to casting

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Tue, 23 May 2006 21:40:56 +0200

tis 2006-05-23 klockan 15:01 -0400 skrev Nick Lewycky:

> If possible, it should store the HttpHeaderEntry objects themselves
> instead of pointers to them. Done properly, there shouldn't be any need
> for a destructor at all.

In this case there was a const barrier which needed to be penetrated,
triggering all of this.. Probably a design error somewhere (missing
write access method, or the code in question executing in the wrong
context).

> if not possible, then HttpHeader should either have an explicit copy
> constructor which does the right thing, or else be non-copyable by
> adding unimplemented private copy constructor and operator= . See
> http://www.boost.org/boost/noncopyable.hpp for the technique.

The latter I think here.. this kind of objects is best copied
explicitly, and C++ is a bit too keen on making copy easy via the normal
methods..

Regards
Henrik

Received on Tue May 23 2006 - 13:41:52 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Jun 01 2006 - 12:00:04 MDT