Since the parameters of your functions take an object of type std::shared_ptr<CPoint> by value, copies of the arguments with which they are called will be passed to the functions. That is, the corresponding argument will either be moved or copied to a function parameter, since the class std::shared_ptr has both a copy constructor and a move constructor.
But the number of links to the pointer that is wrapped in std::shared_ptr will change. That is, when calling functions, the reference count to the original "raw" pointer will change.
Consider the following demo program.
#include <iostream> #include <memory> void f( std::shared_ptr<int> p ) { std::cout << "Inside f() shared_ptr<int>::use_count() = " << p.use_count() << std::endl; } int main() { std::shared_ptr<int> p( new int ( 10 ) ); std::cout << "Before calling f shared_ptr<int>::use_count() = " << p.use_count() << std::endl; f( p ); std::cout << "Aftera calling f shared_ptr<int>::use_count() = " << p.use_count() << std::endl; return 0; }
Her console output is as follows.
Before calling f shared_ptr<int>::use_count() = 1 Inside f() shared_ptr<int>::use_count() = 2 After calling f shared_ptr<int>::use_count() = 1