LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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>
13 public:
14  SortInvalidFirst() = default;
15  constexpr explicit SortInvalidFirst(T const& invalidValue)
16  : invalidValue_{invalidValue}
17  {}
18  constexpr bool
19  operator()(T const& left, T const& right) const
20  {
21  if (left == invalidValue_ && right != invalidValue_) {
22  return true;
23  } else if (right == invalidValue_ && left != invalidValue_) {
24  return false;
25  } else {
26  return left < right;
27  }
28  }
29 
30 private:
32 };
33 
34 #endif /* canvas_Persistency_Provenance_SortInvalidFirst_h */
35 
36 // Local Variables:
37 // mode: c++
38 // End:
constexpr SortInvalidFirst(T const &invalidValue)
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
SortInvalidFirst()=default
Definition: MVAAlg.h:12
constexpr bool operator()(T const &left, T const &right) const