First, the swap method should not be implemented in terms of assignment operator.
I suppose, all it takes to swap two SmartPtr's is to swap the pointers they hold.
You might also implement a free swap function (in terms of member swap), which will hopefully get picked up, for example, when a standard algorithm needs to swap your SmartPtr instances.
void swap(SmartPtr<T>& other)
And now assignment operator would be implemented like this:
(It would also be possible to accept right by value: then temp won't be needed, since a copy will be automatically made.)
SmartPtr<T>& operator=(const SmartPtr<T>& right)
//this takes care of incrementing ref-count on right
//swap contents of left-hand instance and the local copy
//destructor of temp takes care of decrementing ref-count on the pointer previously held by *this