Skip to content

A header-only C++ library for checking the host os/compiler in a modern way.

License

Notifications You must be signed in to change notification settings

NeoDoa-Collective/detector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

detector

A header-only C++ library for checking the host os/compiler, and much more in a modern way.

Getting started

The library is header-only, so you just need to clone it from Github and #include it. That's all. No dependency. No #includes (it doesn't even depend on the standard library).

Example

#include <iostream>
    
void print_os()
{
    if (is_windows_v)
    {
        std::cout << "windows";
    }
    else if (is_linux_v)
    {
        std::cout << "linux";
    }
    else if (is_macos_v)
    {
        std::cout << "macos";
    }
}

int main()
{
    print_os();
}

NOTE: If your compiler supports at least C++17, you can use if constexpr instead of just if. There are other os-es checks supported. If you want to contribute, please create a(n) issue/pull request.

About

A header-only C++ library for checking the host os/compiler in a modern way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.2%
  • CMake 1.8%