Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Vector(STL)

Posted on 2000-04-24
1
233 Views
Last Modified: 2013-12-14
I'd like to know how I can erase the i-th element in vector? I did not find existing API doing this.
0
Comment
Question by:Embt
1 Comment
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 2743849
You can use the erase() member, like

vector<int> V;
int i = ??; // index of item you want to delete.

V.erase(v.begin() + i);

let me know if you have any questions.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best free Visio Editor? 2 191
Add values of each row in an array 3 63
What is sub-make ? 2 71
object oriented programming comparison 5 77
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question