Thread: shared pointer

  1. #1
    Unregistered
    Guest

    shared pointer

    This is the error i get.
    : error C2440: 'return' : cannot convert from 'class SharedPtr<class TrackableObject> *const ' to 'class TrackableObject &'
    This is the code.
    /**
    * This operator will return a refernce to the SharedPtrImpl object.
    * This function will allow for intuitive use of the operator to be used
    * to access
    * our pointer objects. It will return a reference to the SharedPtrImpl
    * object.
    * @return TYPE reference to an object of type TYPE
    */
    TYPE & operator*(void) const
    {
    return this;
    }
    Ive tried returning: &this, *this.
    Any help would be appreciated.

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    TYPE & in the context you've used it is a reference to a TYPE . If you want to return a pointer it should be TYPE*.

  3. #3
    Unregistered
    Guest

    Talking

    Thank you sir.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-06-2009, 12:27 PM
  2. Replies: 1
    Last Post: 03-24-2008, 10:16 AM
  3. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM