mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Made Strings reversible
`AK::String` can now be reversed via AK::String::reverse(). This makes life a lot easier for functions like `itoa()`, where the output ends up being backwards. Very much not like the normal STL (which requires an `std::reverse` object) way of doing things. A call to reverse returns a new `AK::String` so as to not upset any of the possible references to the same `StringImpl` shared between Strings.
This commit is contained in:
committed by
Andreas Kling
parent
093961d2d9
commit
26e81ad574
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/kmalloc.h>
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
NonnullRefPtr<StringImpl> reversed() const;
|
||||
|
||||
private:
|
||||
enum ConstructTheEmptyStringImplTag {
|
||||
ConstructTheEmptyStringImpl
|
||||
|
||||
Reference in New Issue
Block a user