Scope of const reference to a template in C++
I read unique_ptr implementation in STL and have some questions. The code
of unique_ptr::swap() is below:
void
swap(unique_ptr& __u)
{
using std::swap;
swap(_M_t, __u._M_t);
}
I have two questions for the function:
unique_ptr::_M_t is a private member, why can __u._M_t be accessed?
Why template arguments are not specified in unique_ptr& __u? Is this done
by a specific unique_ptr's constructor?
Thanks for your help!
No comments:
Post a Comment