SGI Techpubs Library

IRIX 6.5  »  Books  »  Developer  »  
Standard Template Library Programmer's Guide
(document number: 007-3426-004 / published: 1999-05-21)    table of contents  |  additional info  |  download
find in page

SGI

find

Category: algorithms Component type: function

Prototype

template<class InputIterator, class EqualityComparable>
InputIterator find(InputIterator first, InputIterator last,
                   const EqualityComparable& value);

Description

Returns the first iterator i in the range [first, last) such that *i == value. Returns last if no such iterator exists.

Definition

Defined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h.

Requirements on types

Preconditions

Complexity

Linear: at most last - first comparisons for equality.

Example

list<int> L;
L.push_back(3);
L.push_back(1);
L.push_back(7);

list<int>::iterator result = find(L.begin(), L.end(), 7);
assert(result == L.end() || *result == 7);

Notes

See also

find_if.
[Silicon Surf] [STL Home]
Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation

Standard Template Library Programmer's Guide
(document number: 007-3426-004 / published: 1999-05-21)    table of contents  |  additional info  |  download


home/search | what's new | help

Contact Us | Site Map | Trademarks | Privacy | Using this site means you accept its Terms of Use

Copyright © 1993-2007 SGI, Inc. All rights reserved.