All pastes #246389 Raw Edit

Stuff

public text v1 · immutable
#246389 ·published 2006-11-12 04:18 UTC
rendered paste body
#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
$