[LC++]reference or not

Peter Poulsen peter_poulsen at stofanet.dk
Sun Feb 22 19:46:02 UTC 2004


I have been wondering what is the fastes get methods of the following:

class A {
public:
        int get() const { return _var; }
private:
        int _var;
};

class B {
public:
        int const& get() const { return _var; }
private:
        int _var;
};

I don't know if the latter one is faster because of the reference. I
simply figure out 100% what happens when using a reference as
return-type like that.

Does anybody knows?

-- 
Yours 
Peter Poulsen




More information about the tuxCPProgramming mailing list