spy v1.1.0
Julienne Aisner
 
Loading...
Searching...
No Matches

◆ stdlib

constexpr auto spy::stdlib = stdlib_type{}
inlineconstexpr

C++ Standard Library version reporting value.

The spy::stdlib object can be compared to any other stdlib related value to verify if the code being compiled with a specific version of the C++ standard library.

Any stdlib related value can be checked for equality or ordering for a given version. The targeted version is then specified using a stdlib-dependent literal.

Additionally, any of the stdlib related value are convertible to bool. They evaluates to true if they matches the correct standard library currently used.

Supported Value

Name Vendor
spy::libcpp_ Clang libcpp
spy::gnucpp_ GNU C++ standard library

Example

#include <spy/spy.hpp>
#include <iostream>
int main()
{
// Comparisons
if constexpr( spy::stdlib == spy::gnucpp_ ) std::cout << "This code is compiled with the GNU stdlib.\n";
else if constexpr( spy::stdlib == spy::libcpp_ ) std::cout << "This code is compiled with the Clang stdlib.\n";
// Direct test
if constexpr( spy::gnucpp_ ) std::cout << "This code is compiled with the GNU stdlib.\n";
else if constexpr( spy::libcpp_ ) std::cout << "This code is compiled with the Clang stdlib.\n";
}
constexpr auto stdlib
C++ Standard Library version reporting value.
Definition: stdlib.hpp:85