activemq-cpp-3.8.2
Less.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_UTIL_COMPARATORS_LESS_H_
19 #define _DECAF_UTIL_COMPARATORS_LESS_H_
20 
21 #include <decaf/util/Comparator.h>
22 
23 namespace decaf {
24 namespace util {
25 namespace comparators {
26 
36  template< typename E >
37  class Less : public decaf::util::Comparator<E> {
38  public:
39 
40  Less() {}
41  virtual ~Less() {}
42 
43  virtual bool operator() ( const E& left, const E& right ) const {
44  return left < right;
45  }
46 
47  virtual int compare( const E& o1, const E& o2 ) const {
48 
49  if( o1 > o2 ) {
50  return 1;
51  } else if( o1 < o2 ) {
52  return -1;
53  }
54 
55  return 0;
56  }
57 
58  };
59 
60 }}}
61 
62 #endif /* _DECAF_UTIL_COMPARATORS_LESS_H_ */
Less()
Definition: Less.h:40
A comparison function, which imposes a total ordering on some collection of objects.
Definition: Comparator.h:40
virtual bool operator()(const E &left, const E &right) const
Implementation of the Binary function interface as a means of allowing a Comparator to be passed to a...
Definition: Less.h:43
virtual int compare(const E &o1, const E &o2) const
Compares its two arguments for order.
Definition: Less.h:47
virtual ~Less()
Definition: Less.h:41
Simple Less Comparator that compares to elements to determine if the first is less than the second...
Definition: Less.h:37
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25