From 9cee637a84608fb4a67725fb8c2340c9081146a2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 7 May 2022 00:22:33 +0100 Subject: Add additional addition operators to safe for increment/pointers --- netfs/ice/numeric.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/netfs/ice/numeric.h b/netfs/ice/numeric.h index 16af1f4..e47dc27 100644 --- a/netfs/ice/numeric.h +++ b/netfs/ice/numeric.h @@ -81,6 +81,30 @@ operator+(const Left left, const safe right) return left + static_cast(right); } +template +auto +operator+=(Left & left, const safe right) +{ + return left += static_cast(right); +} + +template +concept pointer = std::is_pointer_v; + +template +auto +operator+=(Left & left, const safe right) +{ + return left += static_cast(right); +} + +template +auto +operator+(const Left left, const safe right) +{ + return left + static_cast(right); +} + template auto operator+(const safe left, const Right right) -- cgit v1.2.3