Skip to content
Snippets Groups Projects
Select Git revision
  • 6d0045d61bd69075363b4cc966315be6c0aec15f
  • main default protected
2 results

hello_c++20_m.cc

Blame
  • hello_c++20_m.cc 389 B
    import <iostream>;
    import <concepts>;
    
    auto message(auto&& x)
    {
        std::cout << x << "\n";
    }
    
    template <class T>
    concept is_a_number = std::integral<T> or std::floating_point<T>;
    
    auto main() -> int
    {
        message("Hello, world!");
        auto n = 1234.0;
        if constexpr (is_a_number<decltype(n)>)
    	std::cout << n << " is a number.\n";
        else
    	std::cout << n << " is not a number!\n";
    }