Edit: I am referring to std::make_shared and std::make_shared, not their actual constructors. I have edited the title but the text below still talks about constructors. Ignore that I use the word "constructor"
I am trying to learn how smart pointers work behind the scenes but the source files seem to go beyond my understanding, so I figured maybe someone here could help me. How does the declaration and implementation of smart pointers' constructors work?
Normally, you create constructors like this:
Object(SomeType member) : member_(member) {}
Smart pointers obviously use class templates to let the coder choose what type the pointer will be pointing to, but the constructor also takes the arguments needed to construct an object of the type the pointer will be pointing to. How is this achieved? How do you create a constructor like this, when we don't know how many or what types of arguments will be needed, since we don't know the type of the object we will be constructing?
Object(/*???*/) : member_(new SomeType(/*???*/)) {}