How change value pointed to by shared_ptr?

This is a discussion on How change value pointed to by shared_ptr? within the C++ Programming forums, part of the General Programming Boards category; If I have: Code: shared_ptr<SomeClass> p( new SomeClass() ); How do i change the value pointed to by p? I ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    184

    How change value pointed to by shared_ptr?

    If I have:

    Code:
    shared_ptr<SomeClass> p( new SomeClass() );
    How do i change the value pointed to by p?

    I want to do something like:

    Code:
    *p = new SomeClass();

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    reset()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. type casting?
    By greatonesv in forum C Programming
    Replies: 12
    Last Post: 10-22-2008, 08:21 PM
  2. c++builder6 change form names problem
    By Leite33 in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2008, 08:20 AM
  3. Change Value in an array
    By beginner999 in forum C Programming
    Replies: 3
    Last Post: 01-18-2003, 06:16 AM
  4. Replies: 2
    Last Post: 11-08-2002, 02:22 AM
  5. Replies: 2
    Last Post: 09-04-2001, 02:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21