Vectors and custom classes

This is a discussion on Vectors and custom classes within the C++ Programming forums, part of the General Programming Boards category; if a class requires a custom copy constructor, overloaded = operator or destructor, it generally needs all three. Of course, ...

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,758
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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?

Page 2 of 2 FirstFirst 12
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, 09:04 PM

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