From 2c45b75249401b359ceb22ca8752193742e346e8 Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Sat, 23 Nov 2024 22:06:47 +0000 Subject: [PATCH] use getline for back compat --- src/Plugin.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Plugin.cpp b/src/Plugin.cpp index cf8eedc..1b6bb6a 100644 --- a/src/Plugin.cpp +++ b/src/Plugin.cpp @@ -1,10 +1,12 @@ #include "plugin.h" #include +#include #include #include -#include +#include #include +#include constexpr const char* c_backends_opt_key = "backends"; @@ -36,12 +38,11 @@ void Plugin::initializeBackends() noexcept mosquitto_log_printf(MOSQ_LOG_INFO, "*** auth-plugin: initializing backends: `%s`", value.c_str()); - const std::string& delim = ","; - const auto tokens = value - | std::views::split(delim) - | std::ranges::to>(); - for (const auto& kind: tokens) { - mosquitto_log_printf(MOSQ_LOG_INFO, "*** auth-plugin: initializing backend: `%s`", kind); + std::string kind; + std::stringstream ss(value); + while (std::getline(ss, kind, ',')) + { + mosquitto_log_printf(MOSQ_LOG_INFO, "*** auth-plugin: initializing backend: `%s`", kind.c_str()); std::unique_ptr backend = BackendFactory(kind, m_options); if (backend != nullptr)