add compareTo

This commit is contained in:
David Rose 2002-02-22 19:11:33 +00:00
parent fca4e4ebfb
commit eb05821d40
3 changed files with 74 additions and 2 deletions

View File

@ -12,8 +12,10 @@
bamReaderParam.h bamWriter.I bamWriter.h bitMask.I \
bitMask.h buttonEvent.I buttonEvent.h buttonHandle.I \
buttonHandle.h buttonRegistry.I buttonRegistry.h \
collideMask.h config_util.N config_util.h \
configurable.h factoryBase.I factoryBase.h \
collideMask.h \
compareTo.I compareTo.h \
config_util.N config_util.h configurable.h \
factoryBase.I factoryBase.h \
factoryParam.I factoryParam.h factoryParams.I \
factoryParams.h \
firstOfPairCompare.I firstOfPairCompare.h \
@ -65,6 +67,7 @@
bamWriter.I bamWriter.h bitMask.I bitMask.h buttonEvent.I \
buttonEvent.h buttonHandle.I buttonHandle.h buttonRegistry.I \
buttonRegistry.h collideMask.h \
compareTo.I compareTo.h \
config_util.h configurable.h factory.I factory.h \
factoryBase.I factoryBase.h factoryParam.I factoryParam.h \
factoryParams.I factoryParams.h \

View File

@ -0,0 +1,29 @@
// Filename: compareTo.I
// Created by: drose (22Feb02)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: CompareTo::operator ()
// Access: Public
// Description: Returns true if a sorts before b, false otherwise.
////////////////////////////////////////////////////////////////////
template<class ObjectType>
INLINE bool CompareTo<ObjectType>::
operator () (const ObjectType &a, const ObjectType &b) const {
return (a.compare_to(b) < 0);
}

View File

@ -0,0 +1,40 @@
// Filename: compareTo.h
// Created by: drose (22Feb02)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef COMPARETO_H
#define COMPARETO_H
#include <pandabase.h>
////////////////////////////////////////////////////////////////////
// Class : CompareTo
// Description : An STL function object class, this is intended to be
// used on any ordered collection of classes that
// contain a compare_to() method. It defines the order
// of the pointers via compare_to().
////////////////////////////////////////////////////////////////////
template<class ObjectType>
class CompareTo {
public:
INLINE bool operator () (const ObjectType &a, const ObjectType &b) const;
};
#include "compareTo.I"
#endif