karansher / computer-graphics-ray-casting

Computer Graphics Assignment about Ray Casting
1 stars 0 forks source link

Purpose of shared_ptr? #25

Open taiti22 opened 1 year ago

taiti22 commented 1 year ago

In first_hit.cpp, the 'objects' parameter is defined as: const std::vector< std::shared_ptr<Object> > & objects. What is the purpose of using shared_ptrs here? Why it is a vector of shared_ptrs to objects, instead of just a vector of objects?