|
JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
|
A C++20 compile-time string wrapper enabling string literals as non-type template parameters (NTTP). More...
#include <utility>#include <string>#include <string_view>#include <cstdint>#include "jh/pods/array.h"#include "jh/pods/string_view.h"#include "jh/metax/hash.h"#include "jh/macros/platform.h"Go to the source code of this file.
Classes | |
| struct | jh::meta::t_str< N > |
| Compile-time string wrapper for use as a non-type template parameter (NTTP). More... | |
Namespaces | |
| namespace | jh::meta |
| Aggregated entry point for compile-time metaprogramming utilities. | |
Typedefs | |
| template<std::uint16_t N> | |
| using | jh::meta::TStr = t_str<N> |
Alias for t_str<N> with template argument deduction. | |
Functions | |
| template<std::uint16_t N> | |
| std::ostream & | jh::meta::operator<< (std::ostream &os, const t_str< N > &str) |
Stream output operator for t_str<N>. | |
A C++20 compile-time string wrapper enabling string literals as non-type template parameters (NTTP).
t_str<N> is a compile-time string container that enables C++20 non-type template parameters (NTTP) with string literals.
Before C++20, it was not possible to bind string literals directly as template arguments. If a type needed an associated string-based metadata, developers had to:
With t_str<N> and the TStr alias, this indirection is no longer needed: string literals can be passed directly as template parameters and validated at compile time.
t_str to inject string literals directly into templates. to_upper(), to_lower(), and flip_case(). N - 1 is the effective length). std::string or immutable_str. 1.4.x
2025