首页 文章
  • 4 votes
     answers
     views

    了解模板类型/值的重复评估

    我有以下代码,我不明白为什么最后 !has_size<Bar>::value 只有在我定义 Bar 之前没有注释掉完全相同的 static_assert( !has_size<Bar>::value, ...) 时才会计算为真 #include <type_traits> template <class, class = void> struct ...
  • 25 votes
     answers
     views

    constexpr if和static_assert

    P0292R1 constexpr if已经included,正在进行C17 . 它似乎很有用(并且可以取代SFINAE的使用),但是有关 static_assert 格式错误的评论,假分支中不需要诊断让我感到害怕: Disarming static_assert declarations in the non-taken branch of a constexpr if is not propo...

热门问题