+ 1

Why type is not required for smart pointer of type shared pointer?

Hi AFIK, shared_ptr is a template class. To create object of that class , we need to specify type. Refer attached code and observe below line into print function: shared_ptr temp = head; why type node is not required like shared_ptr<node> ? I was expecting compiler error without type but it works fine.. How this is possible? https://code.sololearn.com/crYV1fiFiNPr/?ref=app

24th Jul 2021, 3:33 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Réponse
24th Jul 2021, 5:48 PM
Dennis
Dennis - avatar
Aujourd'hui en vedette
What?
0 Votes
HTML
0 Votes
FRC Coding?
1 Votes
Quiz duel
0 Votes
help
0 Votes
AI
2 Votes
APIs
1 Votes
Create Agent
0 Votes