Skip to content

Commit

Permalink
Clarify why we're not using lambdas (#252)
Browse files Browse the repository at this point in the history
Turns out, they can't be `constexpr` until C++17, but we must support
C++14.
  • Loading branch information
chiphogg authored Jun 25, 2024
1 parent 32ae57d commit 46c1cfa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions au/math.hh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ constexpr bool isnan(QuantityPoint<U, R> p) {
}

namespace detail {
// Some compilers do not support lambdas in constexpr contexts, so we make a manual function object.
// We can't use lambdas in `constexpr` contexts until C++17, so we make a manual function object.
struct StdMaxByValue {
template <typename T>
constexpr auto operator()(T a, T b) const {
Expand Down Expand Up @@ -374,7 +374,7 @@ constexpr auto max(T x, Zero z) {
}

namespace detail {
// Some compilers do not support lambdas in constexpr contexts, so we make a manual function object.
// We can't use lambdas in `constexpr` contexts until C++17, so we make a manual function object.
struct StdMinByValue {
template <typename T>
constexpr auto operator()(T a, T b) const {
Expand Down

0 comments on commit 46c1cfa

Please sign in to comment.