Initial support for concept dependency relationships in class diagrams

This commit is contained in:
Bartek Kryza
2023-02-25 01:50:07 +01:00
parent 20a0f2d338
commit 274a698713
15 changed files with 750 additions and 34 deletions

View File

@@ -242,6 +242,39 @@ void for_each_if(const T &collection, C &&cond, F &&func)
});
}
template <typename T, typename F, typename FElse>
void apply_if_not_null(const T *pointer, F &&func, FElse &&func_else)
{
if (pointer != nullptr) {
std::forward<F>(func)(pointer);
}
else if (func_else) {
std::forward<FElse>(func_else)();
}
}
template <typename T, typename F>
void apply_if_not_null(const T *pointer, F &&func)
{
apply_if_not_null(pointer, std::forward<F>(func), []() {});
}
template <typename F, typename FElse>
void apply_if(const bool condition, F &&func, FElse &&func_else)
{
if (condition) {
std::forward<F>(func)();
}
else if (func_else) {
std::forward<FElse>(func_else)();
}
}
template <typename F> void apply_if(const bool condition, F &&func)
{
apply_if(condition, std::forward<F>(func), []() {});
}
std::size_t hash_seed(std::size_t seed);
/**