Thread: Vectors and custom classes

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    if a class requires a custom copy constructor, overloaded = operator or destructor, it generally needs all three.
    Of course, in this case the compiler generated versions will work correctly, so as Daved pointed out it may be best not to write any of the three to begin with.
    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

  2. #17
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by laserlight
    Of course, in this case the compiler generated versions will work correctly, so as Daved pointed out it may be best not to write any of the three to begin with.
    that's why I said "custom".
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using C++ Standard library to generate custom Vectors?
    By Zeeshan in forum C++ Programming
    Replies: 8
    Last Post: 04-04-2008, 09:34 AM
  2. Help With Custom Dynamic Arrays
    By feso4 in forum C++ Programming
    Replies: 3
    Last Post: 06-29-2006, 01:05 PM
  3. Stl sets and custom classes.
    By cunnus88 in forum C++ Programming
    Replies: 3
    Last Post: 05-12-2006, 11:58 PM
  4. How To use vectors for custom classes
    By johnnyd in forum C++ Programming
    Replies: 14
    Last Post: 03-25-2003, 10:04 PM