acl/core/string.h¶
#include "acl/core/string.h"
An immutable string that uses an ACL allocator.
string¶
class string
A basic string class that uses our custom allocator. It is used exclusively for debug purposes.
Strings are immutable.
string::string¶
string(iallocator& allocator, const char* str, size_t length)
Constructs a copy of the first length characters of a string. The characters must not contain a null terminator.
string(iallocator& allocator, const char* str)
Constructs a copy of a null terminated string. A null pointer gives an empty string.
string(iallocator& allocator, const string& str)
Constructs a copy of a string with the given allocator.
string(string&& other) noexcept
Moves the contents of another string. The other string becomes empty.
string::operator=¶
string& operator=(string&& other) noexcept
Swaps the contents of the two strings.
string::operator==¶
bool operator==(const char* other) const noexcept
Returns true if the two strings contain the same characters. A null pointer is equal to an empty string.
bool operator==(const string& other) const noexcept
Returns true if the two strings contain the same characters.
string::operator!=¶
bool operator!=(const char* other) const noexcept
bool operator!=(const string& other) const noexcept
Returns true if the two strings do not contain the same characters.
string::get_allocator¶
iallocator* get_allocator() const noexcept
Returns a pointer to the allocator instance or nullptr if there is none present.
string::get_copy¶
string get_copy() const
string get_copy(iallocator& allocator) const
Returns a copy of the current string. Explicit instead of using the assignment operator or copy constructor
string::c_str¶
const char* c_str() const noexcept
Returns a pointer to the null terminated characters. An empty string returns "".
string::size¶
size_t size() const noexcept
Returns the number of characters, without the null terminator.
string::empty¶
bool empty() const noexcept
Returns true if the string has no characters.