Boost logo

Boost :

From: Kevin Atkinson (kevinatk_at_[hidden])
Date: 2000-03-06 18:46:45


On Mon, 6 Mar 2000, Dave Abrahams wrote:

> on 3/6/00 3:15 PM, Kevin Atkinson at kevinatk_at_[hidden] wrote:
>
> > Here is a more complicated but more efficient operator=:
> >
> > template <typename T>
> > CopyPtr<T> & CopyPtr<T>::operator= (const CopyPtr<T> & other)
> > {
> > if (other.ptr == 0) {
> > delete ptr;
> > ptr = 0;
> > } else if (ptr == 0) {
> > if (other.ptr == 0)
> > ptr = 0;
> ^^^^^^^^ How will this clause ever execute?

And you are absolutely right. I released it after I posted it but decided
not to post yet another correction and see if anyone noticed.

> > else
> > ptr = new T(*other.ptr);
> > } else {
> > *ptr = *other.ptr;
> > }
> > return *this;
> > }
>
>
>
>
> ------------------------------------------------------------------------
> Luck o' the Irish! Get your St. Paddy's day party supplies at
> GreatEntertaining.com today. Green salami, brew kits, shamrock
> confetti, gold coins, & more. Erin Go Bragh!
> http://click.egroups.com/1/2042/1/_/9351/_/952385862/
>
> -- Create a poll/survey for your group!
> -- http://www.egroups.com/vote?listname=boost&m=1
>
>

Kevin Atkinson
kevinatk_at_[hidden]
http://metalab.unc.edu/kevina/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk