vector problem in c++ urgent pls


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: vector problem in c++ urgent pls

  1. #1
    Join Date
    Jul 2006
    Posts
    93

    vector problem in c++ urgent pls

    i need to delete an element form a vector ..

    v.erase(....)
    as all of you know it accepts only address.
    but i want to pass a value and delete that particular value..
    how to do it..

    that means..
    v.erase(value) or
    v.erase((*iter);
    any other ay to sdi it..

  2. #2
    Join Date
    May 2006
    Posts
    176
    I would suggest using of std::remove function, declared in <algorithm>, together with erase member:
    Code:
    v.erase(std::remove(v.begin(), v.end(), value), v.end());
    It removes all of occurences of value.

    I hope this helps.

  3. #3
    Join Date
    Nov 2003
    Posts
    4,118
    As Viorel said, use the remove family of algorithms. You probably want to use remove_if or just plain remove.
    Danny Kalev

Similar Threads

  1. Replies: 2
    Last Post: 10-03-2006, 04:25 AM
  2. TimerTask problem (URGENT HELP NEEDED PLS!)
    By jackbauer in forum Java
    Replies: 1
    Last Post: 09-15-2005, 08:01 AM
  3. Help me pls its urgent
    By max_321 in forum VB Classic
    Replies: 3
    Last Post: 03-16-2005, 02:28 PM
  4. Replies: 1
    Last Post: 07-12-2001, 08:55 PM
  5. Help pls ..Very Urgent
    By Rishi Dhruv in forum Web
    Replies: 0
    Last Post: 10-20-2000, 06:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center