Making `std::get` play nice with SFINAE

后端 未结 4 629
南笙
南笙 2021-02-05 10:20

std::get does not seem to be SFINAE-friendly, as shown by the following test case:

template 
auto foo(C &c) -> declty         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 11:14

    From N4527 (I presume it's still in the standard):

    § 20.4.2.6 (8):

    Requires: The type T occurs exactly once in Types.... Otherwise, the program is ill-formed.

    The program above is ill-formed, according to the standard.

    End of discussion.

提交回复
热议问题