C++ check if statement can be evaluated constexpr

后端 未结 3 1095
无人共我
无人共我 2020-12-23 11:50

Is there a method to decide whether something can be constexpr evaluated, and use the result as a constexpr boolean? My simplified use case is as follows:

te         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 12:42

    template struct require_constant;
    template
    concept has_constexpr_data = requires { typename require_constant; };
    

    This is basically what's used by std::ranges::split_view.

提交回复
热议问题