From 5bcbc96e221bb3aafc370449941bfbd70939915c Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 4 Jan 2023 17:02:19 +0100 Subject: [PATCH] Handle boost::beast::http::basic_fields#set() signature change (v1.81) Make String convertible to boost::beast::string_view (always working), not boost::string_view (broken). --- lib/base/string.cpp | 8 ++++---- lib/base/string.hpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/base/string.cpp b/lib/base/string.cpp index e4e5c273c..3c440cd77 100644 --- a/lib/base/string.cpp +++ b/lib/base/string.cpp @@ -128,15 +128,15 @@ String::operator const std::string&() const } /** - * Conversion function to boost::string_view. + * Conversion function to boost::beast::string_view. * * This allows using String as the value for HTTP headers in boost::beast::http::basic_fields::set. * - * @return A boost::string_view representing this string. + * @return A boost::beast::string_view representing this string. */ -String::operator boost::string_view() const +String::operator boost::beast::string_view() const { - return boost::string_view(m_Data); + return boost::beast::string_view(m_Data); } const char *String::CStr() const diff --git a/lib/base/string.hpp b/lib/base/string.hpp index 10ddaf977..0eb08b527 100644 --- a/lib/base/string.hpp +++ b/lib/base/string.hpp @@ -5,6 +5,7 @@ #include "base/i2-base.hpp" #include "base/object.hpp" +#include #include #include #include @@ -73,7 +74,7 @@ public: bool operator<(const String& rhs) const; operator const std::string&() const; - operator boost::string_view() const; + operator boost::beast::string_view() const; const char *CStr() const;