Lecture Notes for Advanced Programming II

29 April 2004 - Handles Revisited


Outline


Handles


Handle Semantics


Reference Counting


Unsharing for Safety

unsharing


Exceptions


Exception Safety


unshare() and Exception Safety


Making unshare() Exception Safe


Making unshare() Really Exception Safe


Are Handles Exception Safe?


Handles Without Reference Counting


Handles with Handle References


Revised Handles

template < typename T >
class handle

  public:

    handle() 
      : tptr(0), next(this), last(this) { }

    handle(T * tp) 
      : tptr(tp), next(this), last(this) { }

  private:

    T * tptr
    mutable handle * next, * last


Handle Reference Operations


When is const not const?


mutable vs. const


Bibliography


This page last modified on 6 May 2004.