Boost logo

Boost Users :

From: Erik Thiele (erik_at_[hidden])
Date: 2003-05-22 06:34:53


hi

i use my own smartpointer class but hope to consolidate it into some
other standard class some day (like the boost smart_ptr).

an open point is the "this" pointer in classes. i have a problem with
this situation:

class myclass {
  void foo ();
};

void myclass::foo()
{
  // i do not know, if there is a smartpointer on me.
  // in some situations i'd like to have it!
  // that's why "this" exists, but "this" is not a
  // smartpointer! so either i have to get it in my
  // parameter list, or i have to be derived from
  // some "smartpointable" base class and call the
  // thissmartptr() member function.

  // but how should i implement the "thissmartptr" function?
  // in the class construction, nobody gets the smartpointer.
}

void main()
{
  // sp is the smartpointer
  sp<myclass> m (new myclass());

  // does this kind of initialisation still work
  // when the thissmartptr stuff shall be implemented?

}

i have no clue on how to implement the thissmartptr problem. my problems
are class construction. do you have any plans, or is it even already
implemented in the smart_ptr?

cu & thx
erik

-- 
Erik Thiele

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net