countof_ns() is a portable implementation of the macro countof() draft C2y
by means of the C23/C++11 standards or using extensions of the C language
standards of previous editions, which are supported by most compilers.
Incomplete list of supported compilers: Clang, GNU gcc, Intel (classic icc), IntelLLVM (icx), LCC (MCST Elbrus), MSVC (Visual Studio 2022), NVHPC (NVIDIA HPC Compiler), Pelles C, PGI (The Portland Group(?)), SunPro (Oracle Developer Studio).
Implementing the macro countofi_ns() consists of a single, dependency-free
file include/countof_ns.h. You can simply copy this
file to the desired location on the header search paths.
Alternatively, you can use FetchContent in your cmake project:
include(FetchContent)
FetchContent_Declare(
CountofNS
GIT_REPOSITORY https://github.com/Serge3leo/countof_ns.git
GIT_TAG e6b8a03f5c62a0866dda910379240f18d9082e0f # v0.6.0-pre-examples
)
FetchContent_MakeAvailable(CountofNS)
See the example:
examples/cmake_fetch_content/CMakeLists.txt.
This module depends upon a knowledge of Markdown.
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
Sorry for my best English. Alas, this file is actually a yandex translation of README.ru.md with minimal editorial changes.