Refactored template_builder to common namespace (#227)

This commit is contained in:
Bartek Kryza
2024-01-14 13:38:08 +01:00
parent 100f7c88ad
commit 16195bfa62
18 changed files with 545 additions and 359 deletions

View File

@@ -160,6 +160,17 @@ std::string get_git_toplevel_dir();
*/
std::string get_os_name();
template <typename T, typename S>
std::unique_ptr<T> unique_pointer_cast(std::unique_ptr<S> &&p) noexcept
{
if (T *const converted = dynamic_cast<T *>(p.get())) {
p.release();
return std::unique_ptr<T>{converted};
}
return {};
}
/**
* @brief Split a string using delimiter
*