I have a std::vector
want to delete the n'th element. How do I do
that?
std::vector
vec;
vec.push_back(6);
vec.push_back(-17);
vec.push_back(12);
vec.erase(???);
I have a std::vector
want to delete the n'th element. How do I do
that?
std::vector
vec;
vec.push_back(6);
vec.push_back(-17);
vec.push_back(12);
vec.erase(???);
Answer
To delete a single element, you could
do:
std::vector
vec;
vec.push_back(6);
vec.push_back(-17);
vec.push_back(12);
//
Deletes the second element (vec[1])
vec.erase(vec.begin() +
1);
Or, to delete more
than one element at once:
//
Deletes the second through third elements (vec[1],
vec[2])
vec.erase(vec.begin() + 1, vec.begin() +
3);
I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...
No comments:
Post a Comment