Skip to content

Commit ca5ae3f

Browse files
committed
address comments 1
Signed-off-by: Nitish Bharambe <[email protected]>
1 parent 5937456 commit ca5ae3f

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/container_fwd.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ concept component_container_c = requires(ContainerType const& c, ID id, Idx2D id
2424
template <typename ContainerType, typename... RetrievableType>
2525
concept multi_component_container_c = (component_container_c<ContainerType, RetrievableType> && ...);
2626

27-
} // namespace power_grid_model
27+
} // namespace power_grid_model

power_grid_model_c/power_grid_model/include/power_grid_model/main_core/container_queries.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]>
32
//
43
// SPDX-License-Identifier: MPL-2.0
@@ -23,4 +22,4 @@ inline Idx get_component_sequence_idx(ComponentContainer const& components, auto
2322
return components.template get_seq<ComponentType>(id_or_index);
2423
}
2524

26-
} // namespace power_grid_model::main_core
25+
} // namespace power_grid_model::main_core

tests/cpp_unit_tests/test_container.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,21 @@ TEST_CASE("Test component container") {
223223
CHECK(const_container.get_id_by_idx(Idx2D{2, 0}) == 3);
224224
}
225225
#endif // NDEBUG
226+
227+
SUBCASE("Component Container concept") {
228+
static_assert(component_container_c<CompContainer, C>);
229+
static_assert(component_container_c<CompContainer, C1>);
230+
static_assert(component_container_c<CompContainer, C2>);
231+
static_assert(component_container_c<CompContainer2, C>);
232+
static_assert(component_container_c<CompContainer2, C1>);
233+
static_assert(component_container_c<CompContainer2, C2>);
234+
static_assert(multi_component_container_c<CompContainer, C, C1>);
235+
static_assert(multi_component_container_c<CompContainer, C1, C2>);
236+
static_assert(multi_component_container_c<CompContainer, C, C1, C2>);
237+
static_assert(multi_component_container_c<CompContainer2, C, C1>);
238+
static_assert(multi_component_container_c<CompContainer2, C1, C2>);
239+
static_assert(multi_component_container_c<CompContainer2, C, C1, C2>);
240+
}
226241
}
227242

228243
} // namespace power_grid_model

0 commit comments

Comments
 (0)