How will Concepts-Lite interact with variadic templates?

前端 未结 2 578
耶瑟儿~
耶瑟儿~ 2021-02-05 23:33

I watched Bjarne Strustrup\'s talk in Going Native 2013 and he gives the following example for the upcoming concepts-lite feature of C++.

void sort(Container&         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 00:01

    I don't know if N3580 is the latest version of the concept paper but in 4.5.1 it seems to describe how type requirements can be used with variadic argument lists. It seems that

    template 
    auto maximum(T... values) -> 
    

    would require that each of the arguments satisfies the Comparable requirement but there is no restriction that the types T... are all the same. This requirement would need to be imposed separately. Off-hand, the only way I'd know how to impose the same type requirement is the same approach as in C++11 but the concepts facilities may have a better approach.

提交回复
热议问题