Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

bes::Collection Namespace Reference


Classes

struct  bes::Collection::DeleteArray
struct  bes::Collection::DeleteObject
struct  bes::Collection::PtrLess

Functions

template<class C, class T>
C::difference_type findIndex (const C &container, const T &value)


Function Documentation

template<class C, class T>
C::difference_type bes::Collection::findIndex const C &  container,
const T &  value
 

Determines the offset of the first occurrence of a specified value in a container. This is _not_ an STL-ish way to work; the use of std::find() and iterators instead of offsets is _strongly_ preferred, even for vectors.

This function is supplied only as a migration aid for previous users of the Rogue Wave vector classes.

It is valid for any container type C for whose iterators operator- is defined. When a restriction in the STL supplied by RW for Sun is removed in the future (see below), it could be rewritten to work for all containers.

00075                                                     { 
00076       typename C::const_iterator found 
00077         = std::find( container.begin(), container.end(), value );
00078 
00079       // Were std::distance available, one would write:               FIXME
00081 
00082       // Meanwhile, this should only compile for iterators for which it is efficient:
00083       return found - container.begin();
00084     }


Generated on Wed Feb 2 19:15:15 2011 for BOSS6.5.5 by  doxygen 1.3.9.1