我知道什么时候引用是一个函数的参数,并且该函数是内联的,那么引用可能就是引用本身,而不一定是它的指针,但是当引用不是一个参数但是是函数的局部或全局的,或是一个函数的输出,其被内联:在这些情况下如何处理引用?
//global scope
void someFunc(SomeType & ref){//when function is inline, it's possible for ref to be the referent itself
//function body
}
int num=7;
int & ref=num;//what about ref here?
void someFunc1(){
int num=6;
int & ref=num;//what about ref here?
//rest of function body
}
int & someFunc2(){//what about output reference here when function is inlined, will it be num itself or a pointer ?
int num=8;
return num;
}
这个问题到底是“指向”的意思。 – Pooria 2010-12-01 09:56:25