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.

Library

Helper<ToolKit>

Declaration

#include <ospace/helper/helper.h>

template <class Container, class T>
void os_find( Container& c, const T& value, T*& result )
Example <ospace/helper/examples/ofind0.cpp>
#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.