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

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

Posted on 2008-06-22
2
158 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

856 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