From 37ddc710fdb5c27e1df08d890a4dbbaac43dd306 Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Tue, 24 May 2022 00:03:25 +0200 Subject: [PATCH] added contains() overload for easier use with set properties --- server/src/core/property.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/core/property.hpp b/server/src/core/property.hpp index bfeb6e49..5dca11c5 100644 --- a/server/src/core/property.hpp +++ b/server/src/core/property.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2020,2022 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -240,4 +240,10 @@ class Property : public AbstractProperty }; +template>* = nullptr> +inline bool contains(const Property& property, const T& mask) +{ + return (property.value() & mask) == mask; +} + #endif