From 25bd9d77b98443c10b3e122dba1ac47a01e700e3 Mon Sep 17 00:00:00 2001 From: "Maxim [maxirmx] Samsonov" Date: Sun, 2 Jun 2024 01:19:59 +0300 Subject: [PATCH] Added sexp_simple_string_t::c_str method for backwards compatibility --- include/sexpp/sexp.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/sexpp/sexp.h b/include/sexpp/sexp.h index de0d093..360da65 100644 --- a/include/sexpp/sexp.h +++ b/include/sexpp/sexp.h @@ -143,6 +143,13 @@ class SEXP_PUBLIC_SYMBOL sexp_simple_string_t : public std::vector, } uint32_t as_unsigned() const noexcept; + + std::string as_string(void) const + { + return std::string(reinterpret_cast(data()), size()); + } + + std::string c_str(void) const { return as_string(); } }; inline bool operator==(const sexp_simple_string_t *left, const std::string &right) noexcept