LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SortInvalidFirst.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_SortInvalidFirst_h
2 #define canvas_Persistency_Provenance_SortInvalidFirst_h
3 
4 #include <functional>
5 
6 namespace art {
7  template <typename T>
9 }
10 
11 template <typename T>
12 class art::SortInvalidFirst : public std::binary_function<T, T, bool> {
13 public:
15  explicit SortInvalidFirst(T const& invalidValue) : invalidValue_(invalidValue)
16  {}
17  bool
18  operator()(T const& left, T const& right) const
19  {
20  if (left == invalidValue_ && right != invalidValue_) {
21  return true;
22  } else if (right == invalidValue_ && left != invalidValue_) {
23  return false;
24  } else {
25  return left < right;
26  }
27  }
28 
29 private:
31 };
32 
33 #endif /* canvas_Persistency_Provenance_SortInvalidFirst_h */
34 
35 // Local Variables:
36 // mode: c++
37 // End:
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
SortInvalidFirst(T const &invalidValue)
bool operator()(T const &left, T const &right) const
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
HLT enums.