Added size() method

This commit is contained in:
emeric
2025-12-06 22:24:30 +01:00
parent 2d90281b11
commit bbde689a16
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -31,9 +31,19 @@ namespace lms::core
Two,
};
{
constexpr EnumSet<Foo> test;
static_assert(test.size() == 0);
static_assert(test.empty());
static_assert(!test.contains(Foo::One));
static_assert(!test.contains(Foo::Two));
}
{
constexpr EnumSet<Foo> test{ Foo::One };
static_assert(test.size() == 1);
static_assert(!test.empty());
static_assert(test.contains(Foo::One));
static_assert(!test.contains(Foo::Two));
@@ -49,6 +59,8 @@ namespace lms::core
constexpr EnumSet<Foo> test{ Foo::One, Foo::Two };
constexpr auto bitfield{ test.getBitfield() };
static_assert(test.size() == 2);
EnumSet<Foo> test2;
EXPECT_FALSE(test2.contains(Foo::One));
EXPECT_FALSE(test2.contains(Foo::Two));