- C++ 97.9%
- C 2.1%
| include | ||
| .gitignore | ||
| LICENCE.md | ||
| README.md | ||
| uncrustify-cfg | ||
ZPAUK
This is a header-only, C++, template library that aims to have a universal solution for several common problems when using other templates. It has a number of features that exist to compliment or replace those that exist in the C++ STL.
Name
There is no reason for the specific name choice. 'Zpauk' meets the goal of being both pronounceable and lexically unique with only case-insensitive, ASCII characters. It can be pronounced however seems correct to the pronouncer.
Template form identifier system
The template form identifier (TFI) is a short string of characters that identifies the form of a template and is used typically to identify the templates of template parameters.
C++26 does not have the capability to generically deduce nor generate these templates. Syntax like template [[typename, 1], [auto, 1]] typename meaning template <typename, auto> typename, where 1 could be substituted for any number to have that many repeats of a template parameter placeholder, may be supported in future but the utility of such is limited enough at present that it is not believed work will ever begin on such a system.
For this reason, this codebase contains a number of templates (for type aliases, structs, functions, etc.) that contain 0t and 0n or similar in their names. These are the identifiers of the the TFI system. Each block is made up of three parts.
- Count - an integer. '0' means that it represents variadic parameters and can only appear as the final block.
- Kind - 't', 'n', or 'd'; these are respectively 'type', 'non-type', and 'dependent non-type'. These would be identified within a C++ template declaration as
typename T_,auto N_, andT_ D_. - Metadata (optional) - presently only used for 'd', indicates the corresponding parameter index of the 't' that it is typed after.
Groups of type templates that have multiple declarations with names and templates corresponding to the TFI system are referred to as "template-form-identified groups" and presently include repack, unpack, conditional, reverse, and filter. packed_traits uses the system to attempt to identify from a single packed type what template form it is made from and stores that in an enum of recognised TFIs.
Examples
1tbecomes<typename>.1nbecomes<auto>.0tbecomes<typename...>.3n_1t_2d3_0tbecomes<auto, auto, auto, typename T_, T_, T_, typename...>.
Credits
- Primary codebase developer, MnPX
- C++ STL design, Alexander Stepanov