From c1616b032e9597b072de6fae634ef242a6a67b1d Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 25 Apr 2024 15:16:12 +0200 Subject: [PATCH] mapping: add invert() Signed-off-by: Simon Rozman --- include/stdex/mapping.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/stdex/mapping.hpp b/include/stdex/mapping.hpp index 6f13cfca7..0c6cb18b7 100644 --- a/include/stdex/mapping.hpp +++ b/include/stdex/mapping.hpp @@ -68,6 +68,16 @@ namespace stdex { return mapping(from + other.from, to + other.to); } + + /// + /// Reverses source and destination indexes + /// + void invert() + { + T tmp = from; + from = to; + to = tmp; + } }; template >>