This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/cxx14_framework_support
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to
refs/heads/feature/cxx14_framework_support by this push:
new 8cb861e0 Fix C++11 Properties::set with a const char* value
8cb861e0 is described below
commit 8cb861e09f6a43340034a66bd423c4f08498e38a
Author: Pepijn Noltes <[email protected]>
AuthorDate: Tue Nov 1 21:26:58 2022 +0100
Fix C++11 Properties::set with a const char* value
---
libs/utils/include/celix/Properties.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/libs/utils/include/celix/Properties.h
b/libs/utils/include/celix/Properties.h
index 05032328..ab737e08 100644
--- a/libs/utils/include/celix/Properties.h
+++ b/libs/utils/include/celix/Properties.h
@@ -94,6 +94,7 @@ namespace celix {
bool end{false};
};
+
/**
* @brief A collection of strings key values mainly used as meta data for
registered services.
*
@@ -358,19 +359,19 @@ namespace celix {
}
/**
- * @brief Sets a T property. Will use (std::) to_string to convert the
value to string.
+ * @brief Sets a const char* property
*/
- template<typename T>
- void set(const std::string& key, T value) {
- using namespace std;
- celix_properties_set(cProps.get(), key.c_str(),
to_string(value).c_str());
+ void set(const std::string& key, const char* value) {
+ celix_properties_set(cProps.get(), key.c_str(), value);
}
/**
- * @brief Sets a const char* property.
+ * @brief Sets a T property. Will use (std::) to_string to convert the
value to string.
*/
- void set(const std::string& key, const char* value) {
- celix_properties_set(cProps.get(), key.c_str(), value);
+ template<typename T>
+ void set(const std::string& key, T&& value) {
+ using namespace std;
+ celix_properties_set(cProps.get(), key.c_str(),
to_string(value).c_str());
}
#endif