SFINAE: static_assert vs std::enable_if

后端 未结 2 2067
我在风中等你
我在风中等你 2021-02-01 04:51

Are there any disadvantages in the following (suggested!) syntax?

template< typename T >
void f() static_assert(std::is_same< T, int &g         


        
2条回答
  •  孤街浪徒
    2021-02-01 05:40

    Why would using static_assert be better than the Concepts Lite syntax?

    template< typename T >
      void f() requires Int()
      { }
    

    or:

    template< Int T >
      void f()
      { }
    

提交回复
热议问题