Skip to content

Conversation

nitbharambe
Copy link
Member

@nitbharambe nitbharambe commented Sep 9, 2025

From the discussions around #1109 , we bumped into the question about dependent types. Hence a separate PR for discussing/solving this issue.

I had initially thought of having this constraint on MainModelType. But what if we included this check at all_components.hpp only? (Edit: Moving back to MainModelType)

Signed-off-by: Nitish Bharambe <[email protected]>
@nitbharambe nitbharambe self-assigned this Sep 9, 2025
@nitbharambe nitbharambe added the improvement Improvement on internal implementation label Sep 9, 2025
@@ -27,9 +27,56 @@
#include "component/voltage_sensor.hpp"

namespace power_grid_model {
namespace detail {
template <typename List, typename T, typename... NeedsTypes>
concept dependent_type_check = !IsInList<T, List>::value || (IsInList<NeedsTypes, List>::value && ...);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking a different condition previously. It now seems to be possible to move these checks to MainModelType. Ill do so now.

@nitbharambe nitbharambe changed the base branch from main to feature/main-model-refactor-clean-templates-experiment September 10, 2025 13:20
nitbharambe and others added 5 commits September 10, 2025 15:20
… into feature/dependent-component-types-check
Signed-off-by: Nitish Bharambe <[email protected]>
This reverts commit d8a7bfa.

Signed-off-by: Nitish Bharambe <[email protected]>
… into feature/dependent-component-types-check

Signed-off-by: Nitish Bharambe <[email protected]>
… into feature/dependent-component-types-check

Signed-off-by: Nitish Bharambe <[email protected]>

template <typename CompList>
concept validate_component_types_c =
dependent_type_check<CompList, Source, Node> && //
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// in the end to avoid formatting

…ain_core/main_model_type.hpp

Signed-off-by: Nitish Bharambe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement on internal implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant