diff --git a/include/pocketpy/str.h b/include/pocketpy/str.h index cad7efc5..f7cf8b87 100644 --- a/include/pocketpy/str.h +++ b/include/pocketpy/str.h @@ -26,6 +26,7 @@ struct Str{ Str(std::nullptr_t) { FATAL_ERROR(); } Str(const char* s); Str(const char* s, int len); + Str(std::pair); Str(const Str& other); Str(Str&& other); diff --git a/src/str.cpp b/src/str.cpp index 7eb884f8..91a7865a 100644 --- a/src/str.cpp +++ b/src/str.cpp @@ -42,6 +42,19 @@ int utf8len(unsigned char c, bool suppress){ #undef STR_INIT + Str::Str(std::pair detached) { + this->size = detached.second; + this->data = detached.first; + this->is_ascii = true; + // check is_ascii + for(int i=0; i