diff --git a/src/ext/yuni/src/yuni/core/string/traits/append.h b/src/ext/yuni/src/yuni/core/string/traits/append.h index 13f0d20444..3870f408e8 100644 --- a/src/ext/yuni/src/yuni/core/string/traits/append.h +++ b/src/ext/yuni/src/yuni/core/string/traits/append.h @@ -12,6 +12,7 @@ #include "../../traits/length.h" #include "integer.h" #include +#include #include #ifdef YUNI_OS_MSVC @@ -143,6 +144,17 @@ class Append final } }; +// std::string_view +template +class Append final +{ +public: + static void Perform(CStringT& string, std::string_view rhs) + { + string.append(rhs, rhs.length()); + } +}; + // void* template class Append final @@ -272,7 +284,7 @@ class Append> final } }; -// std::vector<> +// std::list<> template class Append> final { @@ -293,7 +305,6 @@ class Append> final s += ']'; } }; - } // namespace CString } // namespace Extension } // namespace Yuni diff --git a/src/ext/yuni/src/yuni/core/traits/extension/into-cstring.h b/src/ext/yuni/src/yuni/core/traits/extension/into-cstring.h index a4b8a0c317..04b83b9b36 100644 --- a/src/ext/yuni/src/yuni/core/traits/extension/into-cstring.h +++ b/src/ext/yuni/src/yuni/core/traits/extension/into-cstring.h @@ -54,6 +54,24 @@ class IntoCString final } }; +template<> +class IntoCString final +{ +public: + enum + { + valid = 1, + converted = 0, + zeroTerminated = 0, + }; + +public: + static const char* Perform(std::string_view v) + { + return v.data(); + } +}; + template class IntoCString> final { diff --git a/src/solver/log-sink/log_sink.cpp b/src/solver/log-sink/log_sink.cpp index 9178b88997..61bd88fd55 100644 --- a/src/solver/log-sink/log_sink.cpp +++ b/src/solver/log-sink/log_sink.cpp @@ -26,6 +26,7 @@ */ #include +#include #include "log_sink.h" namespace Antares::Solver @@ -38,10 +39,12 @@ void LogSink::send(LogSeverity severity, const char* message, size_t message_len) { - // message *is not* '\0'-terminated - // We could use std::string_view to avoid copies, - // but Yuni::Logs::Logger doesn't support them at the moment. - const std::string msg(message, message_len); + /* NOTES + 1. Our logger handles filenames, timestamps, etc. We don't need those. + 2. Message *is not* '\0'-terminated, we must use it's length. + Also, we use std::string_view to avoid copies + */ + const std::string_view msg(message, message_len); switch (severity) { case google::GLOG_INFO: