added contains() overload for easier use with set properties

Dieser Commit ist enthalten in:
Reinder Feenstra 2022-05-24 00:03:25 +02:00
Ursprung 0056ec1a0c
Commit 37ddc710fd

Datei anzeigen

@ -3,7 +3,7 @@
* *
* This file is part of the traintastic source code. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -240,4 +240,10 @@ class Property : public AbstractProperty
}; };
template<class T, std::enable_if_t<is_set_v<T>>* = nullptr>
inline bool contains(const Property<T>& property, const T& mask)
{
return (property.value() & mask) == mask;
}
#endif #endif