Skip to content

Commit a5514d1

Browse files
committed
Convert static_assert in fly::ConfigManager to use a concept
1 parent a71d0ec commit a5514d1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fly/config/config_manager.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include "fly/concepts/concepts.hpp"
34
#include "fly/config/config.hpp"
45
#include "fly/logger/logger.hpp"
56
#include "fly/types/json/json.hpp"
@@ -76,7 +77,7 @@ class ConfigManager : public std::enable_shared_from_this<ConfigManager>
7677
*
7778
* @return A reference to the created/found configuration.
7879
*/
79-
template <typename T>
80+
template <fly::DerivedFrom<Config> T>
8081
std::shared_ptr<T> create_config();
8182

8283
/**
@@ -124,11 +125,9 @@ class ConfigManager : public std::enable_shared_from_this<ConfigManager>
124125
};
125126

126127
//==================================================================================================
127-
template <typename T>
128+
template <fly::DerivedFrom<Config> T>
128129
std::shared_ptr<T> ConfigManager::create_config()
129130
{
130-
static_assert(std::is_base_of_v<Config, T>);
131-
132131
std::shared_ptr<T> config;
133132

134133
std::lock_guard<std::mutex> lock(m_configs_mutex);

0 commit comments

Comments
 (0)