Skip to content

Commit

Permalink
utility: implement abs function
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Sep 27, 2024
1 parent 7c29a93 commit 09aa801
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/frg/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const T &max(const T &a, const T &b) {
return (a < b) ? b : a;
}

template<typename T>
requires (T(-1) < T(0))
const T abs(const T v) {
return (v < 0) ? -v : v;
}

template<typename Tag, typename T>
struct composition : private T {
static T &get(composition<Tag, T> *p) {
Expand Down

0 comments on commit 09aa801

Please sign in to comment.