Initial support for concept dependency relationships in class diagrams
This commit is contained in:
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user