Is the search result pointing to the end of a vector : vector end « vector « C++ Tutorial

Home
C++ Tutorial
1.Language Basics
2.Data Types
3.Operators statements
4.Array
5.Development
6.Exceptions
7.Function
8.Structure
9.Class
10.Operator Overloading
11.Pointer
12.File Stream
13.template
14.STL Introduction
15.string
16.vector
17.list
18.bitset
19.set multiset
20.valarray
21.queue stack
22.deque
23.map multimap
24.STL Algorithms Modifying sequence operations
25.STL Algorithms Non modifying sequence operations
26.STL Algorithms Binary search
27.STL Algorithms Sorting
28.STL Algorithms Merge
29.STL Algorithms Min Max
30.STL Algorithms Iterator
31.STL Algorithms Heap
32.STL Algorithms Helper
C / ANSI-C
C Tutorial
C++
Visual C++ .NET
C++ Tutorial » vector » vector end 
16.15.1.Is the search result pointing to the end of a vector
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

bool greater10int value );

int main()
{
   const int SIZE = 10;
   int aSIZE 102175168131120};
   vector< int > va, a + SIZE );
   
   vector< int >::iterator location;
   location = findv.begin(), v.end()16 );

   if location != v.end() ) 
      cout << "\n\nFound 16 at location " << location - v.begin() );
   else 
      cout << "\n\n16 not found";
   
   location = findv.begin(), v.end()100 );

   if location != v.end() ) 
      cout << "\nFound 100 at location " << location - v.begin() );
   else 
      cout << "\n100 not found";

   location = find_ifv.begin(), v.end(), greater10 );

   if location != v.end() ) 
      cout << "\n\nThe first value greater than 10 is " << *location << "\nfound at location " << location - v.begin() );
   else 
      cout << "\n\nNo values greater than 10 were found";

   return 0;
}

bool greater10int value ) { return value > 10}
16.15.vector end
16.15.1.Is the search result pointing to the end of a vector
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.