mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
f138ef2db5
commit
d7cf7e070b
@ -23,7 +23,7 @@ struct Str{
|
|||||||
char* data;
|
char* data;
|
||||||
char _inlined[16];
|
char _inlined[16];
|
||||||
|
|
||||||
const char* _cached_c_str = nullptr;
|
mutable const char* _cached_c_str = nullptr;
|
||||||
|
|
||||||
bool is_inlined() const { return data == _inlined; }
|
bool is_inlined() const { return data == _inlined; }
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ struct Str{
|
|||||||
Str substr(int start, int len) const;
|
Str substr(int start, int len) const;
|
||||||
Str substr(int start) const;
|
Str substr(int start) const;
|
||||||
char* c_str_dup() const;
|
char* c_str_dup() const;
|
||||||
const char* c_str();
|
const char* c_str() const;
|
||||||
std::string_view sv() const;
|
std::string_view sv() const;
|
||||||
std::string str() const;
|
std::string str() const;
|
||||||
Str lstrip() const;
|
Str lstrip() const;
|
||||||
|
@ -103,7 +103,7 @@ namespace pkpy {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Str::c_str(){
|
const char* Str::c_str() const{
|
||||||
if(_cached_c_str == nullptr){
|
if(_cached_c_str == nullptr){
|
||||||
_cached_c_str = c_str_dup();
|
_cached_c_str = c_str_dup();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user