From de3318a7248363ced76c93c7564f623bcde56dea Mon Sep 17 00:00:00 2001 From: "Maxim [maxirmx] Samsonov" Date: Sun, 2 Jun 2024 01:19:59 +0300 Subject: [PATCH] Added c_str method for backwards compatibility --- include/sexpp/sexp.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/sexpp/sexp.h b/include/sexpp/sexp.h index de0d093..e481b65 100644 --- a/include/sexpp/sexp.h +++ b/include/sexpp/sexp.h @@ -143,6 +143,14 @@ 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