shared_ptr changed to weak_ptr in the priority_queue
Const function added