Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 1.35 KB

File metadata and controls

31 lines (19 loc) · 1.35 KB

consteval_string

A C++20 compile-time (consteval) string library.

Usage

To use this library, simply vendor string.hpp into your codebase.

The jsm::string class

The jsm::string class implements an API similar to std::string. It is templated on a non-type template parameter, N, which indicates a string's non-null-terminated length. The underlying buffer for every jsm::string is null-terminated. If you want to be explicit about the type name, you can use the jsm::consteval_string alias.

A number of consteval operations are also available:

  • map, apply an operation to every character in a string.
  • concat, combine two or more strings.
  • replace, replace instances of a character or substring in a string.
  • split, split a string by some delimiter.
  • and many more...

Development

The tests for this header are located in string_test.cpp. Tests are written using static assertions, with the JSM_EXPECT macro. The JSM_TEST macro is only for organizing tests into groups. To compile the tests, run make test.

The reference documentation is built using Doxygen. To build the documentation run make docs.

License

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at https://www.boost.org/LICENSE_1_0.txt)