In this example by Bjarne, why can you pass a const qualified object to a non-const parameter?

c++, c++11

Solution

If you pass in an lvalue of type `const X`, then `A1` will be deduced as `const X`, and you will get a function that looks like

std::shared_ptr<T> factory(const X& a1) { ... }

Problem

I am reading Bjarne's Rvalue Reference Quick Look and came to the following example: ``` template <class T, class A1> std::shared_ptr<T> factory(A1& a1) { return std::shared_ptr<T>(new T(a1)); } ``` This is much better. If a const-qualified type is passed to the factory, the const will be deduced into the template parameter (A1 for example) and then properly forwarded to T's constructor. I do not understand how `::factory()` can accept a const reference. Bjarne just states that the const will be deduced into the template parameter. What exactly does this mean?

Original source