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:
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:104
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:96
SortInvalidFirst()=default
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
double T
Definition: Xdiff_gwt.C:5
constexpr bool operator()(T const &left, T const &right) const