[*] AuArraySize should return a uint

[*] AuReplaceAll should return a ref equal to arg 0
This commit is contained in:
Reece Wilson 2022-06-14 17:21:10 +01:00
parent 4fb09a68e9
commit cb3b1a582b
2 changed files with 4 additions and 3 deletions

View File

@ -119,7 +119,7 @@ static AuSPtr<T> AuUnsafeRaiiToShared(const AuUPtr<T, Z> &in)
} }
template <class T, AuUInt Z> template <class T, AuUInt Z>
static constexpr int AuArraySize(const T(&array)[Z]) static constexpr AuUInt AuArraySize(const T(&array)[Z])
{ {
return Z; return Z;
} }

View File

@ -78,7 +78,7 @@ static auline AuString AuToUpper(const AuString &in)
} }
#endif #endif
static auline AuString AuReplaceAll(AuString &str, const AuString &from, const AuString &to) static auline AuString &AuReplaceAll(AuString &str, const AuString &from, const AuString &to)
{ {
size_t start_pos = 0; size_t start_pos = 0;
while ((start_pos = str.find(from, start_pos)) != std::string::npos) while ((start_pos = str.find(from, start_pos)) != std::string::npos)
@ -86,7 +86,7 @@ static auline AuString AuReplaceAll(AuString &str, const AuString &from, const A
str.replace(start_pos, from.length(), to); str.replace(start_pos, from.length(), to);
start_pos += to.length(); // Handles case where 'to' is a substring of 'from' start_pos += to.length(); // Handles case where 'to' is a substring of 'from'
} }
return str; // :( return str;
} }
// i told myself not to copy this, required a split function twice, now here we are :D // i told myself not to copy this, required a split function twice, now here we are :D
@ -94,6 +94,7 @@ static auline AuList<AuString> AuSplitString(const AuString &str, const AuString
{ {
AuList<AuString> tokens; AuList<AuString> tokens;
AuUInt prev = 0, pos = 0; AuUInt prev = 0, pos = 0;
tokens.reserve(str.size() / 16);
do do
{ {
pos = str.find(delim, prev); pos = str.find(delim, prev);