Panda3D
 All Classes Functions Variables Enumerations
firstOfPairCompare.I
1 // Filename: firstOfPairCompare.I
2 // Created by: drose (04Apr00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: FirstOfPairCompare::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 template<class ObjectType, class Compare>
23 FirstOfPairCompare(Compare compare) : _compare(compare) {
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: FirstOfPairCompare::operator ()
28 // Access: Public
29 // Description: Returns true if a sorts before b, false otherwise.
30 ////////////////////////////////////////////////////////////////////
31 template<class ObjectType, class Compare>
33 operator () (const ObjectType &a, const ObjectType &b) const {
34  return _compare(a.first, b.first);
35 }
An STL function object class, this is intended to be used on any ordered collection of pairs of objec...
bool operator()(const ObjectType &a, const ObjectType &b) const
Returns true if a sorts before b, false otherwise.