All Projects → unterumarmung → fixed_string

unterumarmung / fixed_string

Licence: MIT License
C++17 string with fixed size

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to fixed string

uninttp
A universal type for non-type template parameters for C++20 or later.
Stars: ✭ 16 (-75%)
Mutual labels:  constexpr, cpp20, cpp-templates
stlkrn
C++ STL in the Windows Kernel with C++ Exception Support
Stars: ✭ 216 (+237.5%)
Mutual labels:  cpp20, cpp17-library
Compile Time Regular Expressions
A Compile time PCRE (almost) compatible regular expression matcher.
Stars: ✭ 2,144 (+3250%)
Mutual labels:  constexpr, cpp20
opzioni
The wanna-be-simplest command line arguments library for C++
Stars: ✭ 29 (-54.69%)
Mutual labels:  constexpr, cpp20
asio-grpc
Asynchronous gRPC with Asio/unified executors
Stars: ✭ 100 (+56.25%)
Mutual labels:  cpp20
clc
No description or website provided.
Stars: ✭ 20 (-68.75%)
Mutual labels:  cpp20
flags17
A comparison of different options to implement binary flags in C++17
Stars: ✭ 16 (-75%)
Mutual labels:  constexpr
harmony
C++ Monadologie
Stars: ✭ 26 (-59.37%)
Mutual labels:  cpp20
crynn
3D Game Engine Created In C++ & OpenGL
Stars: ✭ 45 (-29.69%)
Mutual labels:  cpp20
literal ipaddr
C++17 constexpr implementation of inet_addr / inet_aton / inet_pton
Stars: ✭ 19 (-70.31%)
Mutual labels:  constexpr
samp-ptl
SA:MP Plugin Template Library (C++17)
Stars: ✭ 16 (-75%)
Mutual labels:  cpp17-library
malloy
A C++ library providing embeddable server & client components for both HTTP and WebSocket.
Stars: ✭ 29 (-54.69%)
Mutual labels:  cpp20
StringPool
A performant and memory efficient storage for immutable strings with C++17. Supports all standard char types: char, wchar_t, char16_t, char32_t and C++20's char8_t.
Stars: ✭ 19 (-70.31%)
Mutual labels:  cpp20
constexpr-java
build-time code-execution for java, a bit like constexpr in C++11
Stars: ✭ 58 (-9.37%)
Mutual labels:  constexpr
bitset2
std::bitset with constexpr implementations plus additional features.
Stars: ✭ 76 (+18.75%)
Mutual labels:  constexpr
BinaryLove3
Simple C++ 20 Serialization Library that works out of the box with aggregate types!
Stars: ✭ 13 (-79.69%)
Mutual labels:  cpp20
cefal
(Concepts-enabled) Functional Abstraction Layer for C++
Stars: ✭ 52 (-18.75%)
Mutual labels:  cpp20
sdsl-lite
Succinct Data Structure Library 3.0
Stars: ✭ 55 (-14.06%)
Mutual labels:  cpp20
monolish
monolish: MONOlithic LInear equation Solvers for Highly-parallel architecture
Stars: ✭ 166 (+159.38%)
Mutual labels:  cpp17-library
scope-guard
Implementation of Scoped Guards and Unique Resource as proposed in P0052.
Stars: ✭ 22 (-65.62%)
Mutual labels:  cpp20

fixed_string

C++ library that provides a basic_fixed_string template that combines std::array fixed-size semantic and std::string semantic together

Features

  • C++17 or higher
  • Header-only
  • Dependency-free
  • No dynamic allocations
  • Fully constexpr
  • Can be used as class non-type template parameter (since C++20)

Examples

  • Construction
constexpr fixstr::fixed_string foo = "foo";
  • Concatenation
using namespace fixstr;
constexpr fixed_string first = "Hello, ";
constexpr fixed_string second = "World!";
constexpr auto result = first + second; // "Hello, World!"
  • Comparison
using namespace fixstr;
constexpr fixed_string first = "Hello, ";
constexpr fixed_string second = "World!";
static_assert(first == second); // false
static_assert(first != second); // true
static_assert(first < second);  // true
static_assert(first <= second); // true
static_assert(first > second);  // false 
static_assert(first >= second); // false
static_assert(first <=> second != 0); // true
  • Non-type template parameter
template <fixstr::fixed_string Foo>
void bar()
{
    static_assert(Foo == "foo"sv);
}

void foo()
{
    bar<"foo">();
}

Integration

Since it's a header only library, you need just copy fixed_string.hpp to your project.

If you are using vcpkg on your project for external dependencies, then you can use the fixed-string package.

If you are using Conan on your project for external dependencies, then you can use the Conan recipe located in the root of the repository.

Compiler compatibility

  • GCC >= 7.3
  • Clang >= 5
  • ICC >= 19.0.1
  • 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)

Using basic_fixed_string as class non-type template parameter full available in GCC >= 10 and VS 2019 16.9 or newer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].