Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igozdev/charimpl
Compile-time header-only char implementation checking for C++03/11/14/17/20
https://github.com/igozdev/charimpl
compile-time cpp cpp03 cpp11 cpp14 cpp17 cpp20 header-only modern-cpp no-dependencies
Last synced: about 1 month ago
JSON representation
Compile-time header-only char implementation checking for C++03/11/14/17/20
- Host: GitHub
- URL: https://github.com/igozdev/charimpl
- Owner: igozdev
- License: mit
- Created: 2023-08-05T05:12:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-05T06:21:49.000Z (over 1 year ago)
- Last Synced: 2024-10-19T20:08:10.678Z (3 months ago)
- Topics: compile-time, cpp, cpp03, cpp11, cpp14, cpp17, cpp20, header-only, modern-cpp, no-dependencies
- Language: C++
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# charimpl
> Compile-time header-only `char` implementation checking for **C++03**/**11**/**14**/**17**/**20**[![license][badge.license]][license]
[![release][badge.release]][release]
[![godbolt][badge.godbolt]][godbolt][badge.license]: https://img.shields.io/badge/license-mit-green.svg
[license]: https://github.com/igozdev/charimpl/blob/main/LICENSE[badge.release]: https://img.shields.io/github/release/igozdev/charimpl.svg
[release]: https://github.com/igozdev/charimpl/releases/latest[badge.godbolt]: https://img.shields.io/badge/try_it-on_godbolt-indigo.svg
[godbolt]: https://godbolt.org/z/rGqM1YMsd# Example
```cpp
#include
#includeint main()
{
std::cout << std::boolalpha
<< charimpl::is_ascii() << std::endl
<< charimpl::is_ebcdic() << std::endl
<< charimpl::is_ebcdic037() << std::endl
<< charimpl::is_ebcdic1047() << std::endl;
}
```#
All functions are marked as consteval/constexpr and noexcept if allowed by the compiler.
```c++
bool charimpl::is_ascii(); // Returns true if ASCII encoding is currently in use, false otherwise
bool charimpl::is_ebcdic(); // Returns true if any form of EBCDIC encoding is currently in use, false otherwise
bool charimpl::is_ebcdic037(); // Returns true if EBCDIC037/IBM037 encoding is currently in use, false otherwise
bool charimpl::is_ebcdic273(); // Returns true if EBCDIC273/IBM037 encoding is currently in use, false otherwise
bool charimpl::is_ebcdic1047(); // Returns true if EBCDIC1047/IBM1047 encoding is currently in use, false otherwise
```
```c++
CHARIMPL_ASCII_EXPR // Macro which expands to an expression equal to the result of charimpl::is_ascii()
CHARIMPL_EBCDIC_EXPR // Macro which expands to an expression equal to the result of charimpl::is_ebcdic()
CHARIMPL_EBCDIC037_EXPR // Macro which expands to an expression equal to the result of charimpl::is_ebcdic037()
CHARIMPL_EBCDIC273_EXPR // Macro which expands to an expression equal to the result of charimpl::is_ebcdic273()
CHARIMPL_EBCDIC1047_EXPR // Macro which expands to an expression equal to the result of charimpl::is_ebcdic1047()
```
*Note: Macros should be surrounded with parentheses when used in larger statements in order to avoid potential issues with operator precedence*