#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    81
    Rep Power
    12

    emptying a vector


    I have a vector myVector which is declared as a protected member.
    my vector is defined a sfollows/.
    std::vector < std::vector < double > > myVector.
    After I resized this vector, I store ceratin values. Then I want to clear this and store different values.
    I did myVector.clear();
    But it does not become empty and I get a segmentation fault.
    I also try to clear the vector inside and tehn do clear on my vector.
    I get a segmentation fault.
    I guess may be teh problem is because it is a member of the class.
    Any suggestions?
    Thanks,
    lalitha.V
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    244
    Please post some code that compiles and has the problem so we can diagnose it. Be sure to use "code" tags.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

IMN logo majestic logo threadwatch logo seochat tools logo