/Users/deen/code/yugabyte-db/src/yb/util/minmax.h
Line | Count | Source (jump to first uncovered line) |
1 | | // |
2 | | // Copyright (c) YugaByte, Inc. |
3 | | // |
4 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
5 | | // in compliance with the License. You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
10 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
11 | | // or implied. See the License for the specific language governing permissions and limitations |
12 | | // under the License. |
13 | | // |
14 | | // |
15 | | |
16 | | #ifndef YB_UTIL_MINMAX_H |
17 | | #define YB_UTIL_MINMAX_H |
18 | | |
19 | | template<class T> |
20 | | struct MinMaxTracker { |
21 | 0 | void operator()(T t) { |
22 | 0 | if (!inited) { |
23 | 0 | min = std::move(t); |
24 | 0 | max = min; |
25 | 0 | inited = true; |
26 | 0 | return; |
27 | 0 | } |
28 | 0 | if (t < min) { |
29 | 0 | min = std::move(t); |
30 | 0 | } else if (max < t) { |
31 | 0 | max = std::move(t); |
32 | 0 | } |
33 | 0 | } Unexecuted instantiation: _ZN13MinMaxTrackerIxEclEx Unexecuted instantiation: _ZN13MinMaxTrackerINSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEclES6_ Unexecuted instantiation: _ZN13MinMaxTrackerIN2yb10HybridTimeEEclES1_ |
34 | | |
35 | | bool inited = false; |
36 | | T min = T(); |
37 | | T max = T(); |
38 | | }; |
39 | | |
40 | | #endif // YB_UTIL_MINMAX_H |