Solved

std::search - question about last parameter...

Posted on 2008-06-22
2
159 Views
Last Modified: 2010-04-21
Hi,

Quote from cplusplus.com:

first1, last1
    Forward iterators to the initial and final positions of the searched sequence. The range used is [first1,last1), which contains all the elements between first1 and last1, including the element pointed by first1 but not the element pointed by last1.

Does this mean that if I'm looking for a vector that has a size of 1, that the last element of the main vector won't be searched? I.e:

ABCD
D

D wouldn't be found?

Thanking you. :)
Uni
0
Comment
Question by:Unimatrix_001
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 21843157
No, the 'last' element (available via the 'end()' member of the respective container) is a 'pseudo-iterator' (you'll get an exception when thrying to access its contents) representing a special state of the iteration, thus I just assume poor wording while having that in mind.
0
 
LVL 3

Author Closing Comment

by:Unimatrix_001
ID: 31469616
Okay thanks - that makes more sense. :)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

685 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