| 
 |  | 
   template <class T>    
   const T* bin_search(     
         const T& val,  
         const T* b,      
         const T* e
   );     
   template <class T>    
   const T* bin_search_r(  
         int (*rel)(const T)*,
         const T)*),  
         const T& val,         
         const T* b,
         const T* e   
   );
These functions find the rightmost element in a sorted array equal to val and return a pointer to it. They return 0 if no such value exists.
   template <class T>
   const T* bin_search(
       const T& val,
       const T* b,
       const T* e
       );
Uses T::operator< to find the element.
   template <class T>
   const T* bin_search_r(
       int (*rel)(const T)*, const T)*),
       const T& val,
       const T* b,
       const T* e
       );
Uses rel to find the element.
If N is the size of the array, then complexity is O(lgN). At most lgN tests of the relation are done.
Because a Block (see Block(3C++)) can always be used wherever an array is called for, Array Algorithms can also be used with Blocks. In fact, these two components were actually designed to be used together.