CMS 3D CMS Logo

TkTrackingRegionsMargin.h
Go to the documentation of this file.
1 #ifndef TkTrackingRegionsMargin_H
2 #define TkTrackingRegionsMargin_H
3 
6 #include <utility>
7 #include <iostream>
8 
9 template <class T>
10 class TkTrackingRegionsMargin : public std::pair<T, T> {
11 public:
13 
14  TkTrackingRegionsMargin(const T& aLeft, const T& aRight) : std::pair<T, T>(aLeft, aRight) {}
15 
16  TkTrackingRegionsMargin(const std::pair<T, T>& aPair) : std::pair<T, T>(aPair) {}
17 
18  const T& left() const { return this->first; }
19  const T& right() const { return this->second; }
20 
21  void operator+=(const T& v) { add(v, v); }
22  void add(const T& addLeft, const T& addRight) {
23  this->first += addLeft;
24  this->second += addRight;
25  }
26 };
27 
28 template <class T>
29 std::ostream& operator<<(std::ostream& out, const TkTrackingRegionsMargin<T>& m) {
30  return out << "(" << m.left() << "," << m.right() << ")";
31 }
32 #endif
void add(const T &addLeft, const T &addRight)
U second(std::pair< T, U > const &p)
TkTrackingRegionsMargin(const std::pair< T, T > &aPair)
TkTrackingRegionsMargin(const T &aLeft, const T &aRight)
long double T