_The SGI Standard Template Library_
by Matthew H. Austern 

Listing One
int* find1(int* first, int* last, int value) 
{ 
   while (first != last && *first != value) 
      ++first; 
   return first; 
} 

Listing Two
template <class InputIterator, class T> 
InputIterator find(InputIterator first, InputIterator last, const T& value) 
{ 
 while (first != last && *first != value) 
   ++first; 
 return first; 
} 


Listing Three 
template <class InputIterator, class Predicate> 
InputIterator find_if(InputIterato r first,InputIterator last,Predicate pred) 
{ 
   while (first != last && !pred(*first)) 
       ++first; 
   return first; 
} 

Listing Four
#include <hash_map.h> 
#include <stdio.h> 
struct eqstr { 
   bool operator()(const char* s1, const char* s2) const { 
     return strcmp(s1, s2) == 0; 
   } 
}; 
int main() 
{ 
   hash_map<char*, int, hash<char*>, eqstr> days; 
   days["January"] = 31; 
   days["February"] = 28; 
   days["March"] = 31; 
   days["April"] = 30; 
   days["May"] = 31; 
   days["June"] = 30; 
   printf("%s has %d days\n", "March", days["March"]); 
   return 0; 
} 

Listing Five 
iterator insert(iterator position, const T& x) { 
  link_type tmp = get_node(); 
  construct(&((*tmp ).dat a), x); 
  (*tmp).next = position.node; 
  (*tmp).prev = (*position.node).prev; 
  (*(link_type((*po sitio n.nod e).pr ev))).nex t = tmp; 
  (*position.node). prev = tmp; 
  ++length; 
  return tmp; 
} 

Listing Six
link_type get_node() { 
  link_type tmp = free_list; 
  return free_list 
      ? (free_list = (link_type)(free_l ist- >next ), tmp) 
      : (next_avail == last ? (add_new_buffer(), next_avail++) 
                              : next_avail++); } 

Listing Seven
link_type get_node() { 
   return list_node_alloc ator: :allocate( ); 
} 

