https://github.com/mjz86/basic_string
a c++20 string class library that aims to achive performance and memory efficiency while being constexpr friendly
https://github.com/mjz86/basic_string
cpp20 cpp23-library string string-algorithms string-formatter string-manipulation string-optimization strings
Last synced: 8 months ago
JSON representation
a c++20 string class library that aims to achive performance and memory efficiency while being constexpr friendly
- Host: GitHub
- URL: https://github.com/mjz86/basic_string
- Owner: Mjz86
- License: apache-2.0
- Created: 2025-02-01T11:23:53.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-02-01T13:22:47.000Z (9 months ago)
- Last Synced: 2025-02-01T13:32:57.172Z (9 months ago)
- Topics: cpp20, cpp23-library, string, string-algorithms, string-formatter, string-manipulation, string-optimization, strings
- Language: C++
- Homepage:
- Size: 99.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# basic_String
this is the mjz string library,
it uses the newest C++20 features and sometimes a bit of c++23 ones.
originally only compiled in msvc, but i recently ensured that gcc works as well.
its currently in the alpha version and most features are not polished,well-tested,well-documented.
curruntly , the library supports:
1-string minipulation with most of the equivalent functions to
std::string
(https://en.cppreference.com/w/cpp/string/basic_string)
and
std::string_view
(https://en.cppreference.com/w/cpp/string/basic_string_view)
2-compile-time execution support of all of the functions (except the ones that are using std::iostream or something that is inheritly not constexpr in the standard)
3-all of the functions are noexcept (except the ones that are using std::iostream )
4-extended-COW(copy-on-write, sharing substings)
5-SSO(small string optimization with capacity of 15 in 64bit and 7 in other platforms)
6-built-in-viewer( the string litterals are not cpied until modification)
7-custom allocators(its like a constexpr form of std::pmr::polymorphic_allocator)
8-stack-buffers(opt-in, you can use an stack buffer to avoid allocations, note that this doesn't require an allocator and that it doesn't support COW)
9-thread-safty while COW(can opt-out)
10- some parts of std::format (still in progress)
my plan for the future versions:
1-full std::format functionality compatibility
2-more fmt::format functionality compatibility
3-easier to use api for the byte-string
4-addition of regex support
5-more documentatin,testing and comments
6-copy-less(by using sharing instead of copy and insertion of a shared substring insead of vector insertion )
rope(array of substrings) and or tree(balanced binary tree of substrings) alternatives for string in cases where the text is large
my plan for custom-encoding/Unicode support:
1-ability to use UTF-8 in formatting
2-ability to iterate over code unit,point,grapheme, and grapheme cluster
3-addition of normalization support
4-more features if needed
i would appreciate if you give feedback, although note that i know that the documentation is currently lacking.
for compilation of the test file you can simply do:
(i used g++ 12.2.0)
g++ -std=c++2a main.cpp