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

◆ operating_system

constexpr os_type spy::operating_system
inlineconstexpr

OS reporting value.

The spy::operating_system object can be compared to any other OS related value to verify if the code being compiled is compiled on a given Operating Systems.

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

Supported Value

Name Operating System
spy::android_ Android
spy::bsd BSD
spy::cygwin_ CYGWIN
spy::ios_ iOS
spy::linux_ Linux
spy::macos_ MacOS
spy::unix_ UNIX
spy::windows_ Windows

Example

#include <spy/spy.hpp>
#include <iostream>
int main()
{
// Comparisons
if constexpr( spy::operating_system == spy::bsd_ ) std::cout << "This code runs on BSD.\n";
else if constexpr( spy::operating_system == spy::linux_ ) std::cout << "This code runs on Linux.\n";
else if constexpr( spy::operating_system == spy::windows_ ) std::cout << "This code runs on Windows.\n";
// Direct test
if constexpr( spy::bsd_ ) std::cout << "This code runs on BSD.\n";
else if constexpr( spy::linux_ ) std::cout << "This code runs on Linux.\n";
else if constexpr( spy::windows_ ) std::cout << "This code runs on Windows.\n";
}
constexpr os_type operating_system
OS reporting value.
Definition: os.hpp:106