mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 13:35:12 +00:00
AK: Add a comment to String about the relationship with StringImpl.
This commit is contained in:
parent
93d3d1ede1
commit
e24f18dd83
Notes:
sideshowbarker
2024-07-19 13:47:58 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e24f18dd838
1 changed files with 20 additions and 0 deletions
|
@ -10,6 +10,26 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
// String is a convenience wrapper around StringImpl, suitable for passing
|
||||
// around as a value type. It's basically the same as passing around a
|
||||
// RetainPtr<StringImpl>, with a bit of syntactic sugar.
|
||||
//
|
||||
// Note that StringImpl is an immutable object that cannot shrink or grow.
|
||||
// Its allocation size is snugly tailored to the specific string it contains.
|
||||
// Copying a String is very efficient, since the internal StringImpl is
|
||||
// retainable and so copying only requires modifying the retain count.
|
||||
//
|
||||
// There are three main ways to construct a new String:
|
||||
//
|
||||
// s = String("some literal");
|
||||
//
|
||||
// s = String::format("%d little piggies", m_piggies);
|
||||
//
|
||||
// StringBuilder builder;
|
||||
// builder.append("abc");
|
||||
// builder.append("123");
|
||||
// s = builder.to_string();
|
||||
|
||||
class String {
|
||||
public:
|
||||
~String() {}
|
||||
|
|
Loading…
Add table
Reference in a new issue