Skip to content

Commit 5f0060b

Browse files
Create README.md
1 parent 4ee25f7 commit 5f0060b

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# fixed_string
2+
C++ library that provides a `basic_fixed_string` template that combines `std::array` fixed-size semantic and `std::string` semantic together
3+
4+
## Features
5+
6+
* C++17 or higher
7+
* Header-only
8+
* Dependency-free
9+
* No dynamic allocations
10+
* Fully constexpr
11+
* Can be used as class non-type template parameter __(since C++20)__
12+
13+
## Examples
14+
15+
* Construction
16+
```cpp
17+
constexpr fixstr::fixed_string foo = "foo";
18+
```
19+
20+
* Concatenation
21+
```cpp
22+
using namespace fixstr;
23+
constexpr fixed_string first = "Hello, ";
24+
constexpr fixed_string second = "World!";
25+
constexpr auto result = first + second; // "Hello, World!"
26+
```
27+
28+
* Comparison
29+
```cpp
30+
using namespace fixstr;
31+
constexpr fixed_string first = "Hello, ";
32+
constexpr fixed_string second = "World!";
33+
static_assert(first == second); // false
34+
static_assert(first != second); // true
35+
static_assert(first < second); // true
36+
static_assert(first <= second); // false
37+
static_assert(first > second); // false
38+
static_assert(first >= second); // false
39+
static_assert(first <=> second != 0); // true
40+
```
41+
42+
* Non-type template parameter
43+
```cpp
44+
template <fixstr::fixed_string Foo>
45+
void bar()
46+
{
47+
static_assert(Foo == "foo"sv);
48+
}
49+
50+
void foo()
51+
{
52+
bar<"foo">();
53+
}
54+
```
55+
56+
## Integration
57+
Since it's a header only library, you need just copy `fixed_string.hpp` to your project.
58+
59+
## Compiler compatibility
60+
* GCC >= 7.3
61+
* Clang >= 5
62+
* ICC >= 19.0.1
63+
* MSVC >= 14.28 / Visual Studio 2019 (I don't have access to older VS versions right now, so it can work on older versions too)
64+
65+
**Using `basic_fixed_string` as class non-type template parameter full available in GCC >= 10**

0 commit comments

Comments
 (0)