Stuff
public text v1 · immutable#include <string>
#include <iostream>
using namespace std;
void PassByRef( const string & sFoo )
{
cerr << "PassByRef: " << (size_t)&sFoo << endl;
}
void PassByCopy( const string sFoo )
{
cerr << "PassByCopy: " << (size_t)&sFoo << endl;
}
int main()
{
string sFoo = "blah";
cerr << "Original: " << (size_t)&sFoo << endl;
PassByRef( sFoo );
PassByCopy( sFoo );
return( 0 );
}
$ ./foo
Original: 3213748880
PassByRef: 3213748880
PassByCopy: 3213748864
$