Thread: error: cannot convert 'std::string' to 'std::string*' in assignment??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Well, if Programmer_P ever uses Sebastiani's idea, then comes round asking why there was a mismatch in the number of constructor and destructor invocations, then Sebastiani better be at hand to give a good answer, or we get to roast him over a slow burning fire

    Quote Originally Posted by Sebastiani
    Sorry, but that's incorrect - the code just invokes the constructor on an existing object, so the reference member 'data' does indeed get reassigned.
    No, it does not. We're dealing with a new object. What happens is that the constructor is invoked to create a new object, which is then placed in memory in the same location as an existing object.
    Last edited by laserlight; 06-02-2010 at 01:47 PM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 02:34 AM
  2. Convert uint16_t to std::string?
    By magicalo in forum C++ Programming
    Replies: 3
    Last Post: 07-18-2008, 01:34 AM
  3. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  4. What is the easies way to convert int to std::string?
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 12-04-2007, 02:15 AM
  5. Replies: 1
    Last Post: 10-27-2006, 01:21 PM