mardi 6 août 2019

Why do we need to pass const shared pointer as reference?

While I was reading an open-source code, I found the following where a shared pointer is passed to a function in two different ways.

typedef boost::shared_ptr<Frame> FramePtr;

void func1(FramePtr frame);

void func2( const FramePtr& frame);

What is the reason to pass it as a reference when const is used?

Code: https://github.com/uzh-rpg/rpg_svo/

Aucun commentaire:

Enregistrer un commentaire