Created
November 13, 2019 01:43
-
-
Save vinniefalco/f3f6f158014e8ba17c6022ebdbd18248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class string_impl | |
{ | |
struct table | |
{ | |
std::uint32_t size; | |
std::uint32_t capacity; | |
}; | |
struct sbo | |
{ | |
kind k; | |
char buf[ | |
2*sizeof(table*)-sizeof(kind)]; | |
}; | |
struct pointer | |
{ | |
kind k; | |
char pad[ | |
sizeof(table*)-sizeof(kind)]; | |
table* t; | |
}; | |
union | |
{ | |
sbo s_; | |
pointer p_; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment