std::ref的用法遇到一个编译错误!
下面这段代码编译有错误:
#include<iostream>using namespace std;struct s{ int i; s():i(11){cout<<__FUNCTION__<<endl;} s(const s& ss):i(ss.i){cout<<__FUNCTION__<<endl;} s& operator=(const s&ss){i=ss.i;cout<<__FUNCTION__<<endl;}};template<typename T>void f( T t ){ cout<<t.i<<endl; cout<<__FUNCTION__<<endl;}int main(void){ s s1; f( std::cref(s1) ); return 0;}