Type trait to check that all types in a parameter pack are copy constructible

后端 未结 4 504
生来不讨喜
生来不讨喜 2020-12-08 04:36

I need a type trait to check whether all types in a parameter pack are copy constructible. This is what I\'ve done so far. The main function contains some test cases, to che

4条回答
  •  半阙折子戏
    2020-12-08 05:31

    I prefer @Columbo's bool_pack trick. First a template to test that everything in a bool parameter pack is true:

    template struct bool_pack;
    template 
    using all_true = std::is_same, bool_pack>;
    

    Then

    template
    using areCopyConstructible = all_true::value...>;
    

提交回复
热议问题