[Insight-developers] add operator< and operator> support initk::Index

Brad King brad.king at kitware.com
Fri Jun 3 12:12:01 EDT 2005


Miller, James V (Research) wrote:
> For storage and searching lexicographically, I can understand the 
> motivation.  But since it does not have a geometic meaning, I 
> hesitate to put it into Index.  The whole purpose of Index to 
> provide a link between a geometric space and the linear address
> space an image uses to store its pixels.
> 
> Can we provide function objects (that people will have to go out
> of their way to use) to provide a lexicographically ordering of 
> Indices?

Sure:

template <unsigned int VDimension>
struct IndexLexicographicCompare
{
   bool operator()(Index<VDimension> const& l,
                   Index<VDimension> const& r) const
     {
     ...
     }
};

std::set< Index<D>, IndexLexicographicCompare<D> > myIndexSet;

-Brad


More information about the Insight-developers mailing list