std::make_tuple doesn't make references

后端 未结 6 825
名媛妹妹
名媛妹妹 2020-12-04 23:53

I\'ve been experimenting with std::tuple in combination with references:

#include 
#include 

int main() {
  int a,         


        
6条回答
  •  青春惊慌失措
    2020-12-05 00:37

    For the why: make_tuple parameters are passed by const reference (const T&), so if you pass int&, T matches int. If it deduced T to be int&, the parameter would be const T&&, and you'd get a compile error.

提交回复
热议问题