os_find |
Locates an item in a container.
A helper algorithm for find()
. Searches for an element in container c that matches value
using operator== . Sets result
to point to the first matching element, or zero if no match is found.
#include <ospace/helper/helper.h>
template <class Container, class T>
void os_find( Container& c, const T& value, T*& result )
#include <iostream>
#include <vector>
#include <ospace/helper.h>
int numbers[ 10 ] = { 0, 1, 4, 9, 16, 25, 36, 49, 64 };
void
main()
{
vector< int > v( numbers, numbers + 10 );
int* location = 0;
os_find( v, 25, location );
if ( location )
cout << "Found " << *location << "\n";
}
Found 25
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.