8000 Lint library · amalbansode/numeric-range@d2183e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit d2183e9

Browse files
committed
Lint library
1 parent 669d1a4 commit d2183e9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/numeric_range.hpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class NumericRange
1111
double ub = 0;
1212
bool ub_inclusive = true;
1313

14-
NumericRange(const double _lb, const bool _lb_inclusive,
15-
const double _ub, const bool _ub_inclusive) :
16-
lb(_lb), lb_inclusive(_lb_inclusive),
17-
ub(_ub), ub_inclusive(_ub_inclusive)
14+
NumericRange (const double _lb, const bool _lb_inclusive,
15+
const double _ub, const bool _ub_inclusive) :
16+
lb(_lb), lb_inclusive(_lb_inclusive),
17+
ub(_ub), ub_inclusive(_ub_inclusive)
1818
{
1919
if (lb > ub)
2020
{
@@ -26,17 +26,17 @@ class NumericRange
2626
}
2727
}
2828

29-
explicit NumericRange(double _scalar) :
30-
lb(_scalar), lb_inclusive(true),
31-
ub(_scalar), ub_inclusive(true)
29+
explicit NumericRange (double _scalar) :
30+
lb(_scalar), lb_inclusive(true),
31+
ub(_scalar), ub_inclusive(true)
3232
{}
3333
};
3434

3535
// Is LHS < RHS?
3636
class NumericRangeComparator
3737
{
3838
public:
39-
bool operator()(const NumericRange& lhs, const NumericRange& rhs) const
39+
bool operator() (const NumericRange &lhs, const NumericRange &rhs) const
4040
{
4141
const bool lhs_is_scalar = (lhs.lb == lhs.ub);
4242
const bool rhs_is_scalar = (rhs.lb == rhs.ub);
@@ -56,21 +56,24 @@ class NumericRangeComparator
5656
else
5757
{
5858
if (lhs.lb == rhs.lb && lhs.lb_inclusive == rhs.lb_inclusive
59-
&& lhs.ub == rhs.ub && lhs.ub_inclusive == rhs.ub_inclusive)
59+
&& lhs.ub == rhs.ub && lhs.ub_inclusive == rhs.ub_inclusive)
6060
{
6161
return false;
6262
}
63-
else if ((lhs.ub < rhs.lb) || (lhs.ub == rhs.lb && !(lhs.ub_inclusive && rhs.lb_inclusive)))
63+
else if ((lhs.ub < rhs.lb) ||
64+
(lhs.ub == rhs.lb && !(lhs.ub_inclusive && rhs.lb_inclusive)))
6465
{
6566
return true;
6667
}
67-
else if ((lhs.lb > rhs.ub) || (lhs.lb == rhs.ub && !(lhs.lb_inclusive && rhs.ub_inclusive)))
68+
else if ((lhs.lb > rhs.ub) ||
69+
(lhs.lb == rhs.ub && !(lhs.lb_inclusive && rhs.ub_inclusive)))
6870
{
6971
return false;
7072
}
7173
else
7274
{
73-
throw std::runtime_error("Invalid comparison between overlapping ranges");
75+
throw std::runtime_error(
76+
"Invalid comparison between overlapping ranges");
7477
}
7578
}
7679
} // bool operator()

0 commit comments

Comments
 (0)
0