I am reading through Nicolai M. Josuttis' "The C++ Standard Library (Second Edition)" and have just reached the section on std::pair
. The author notes that:
Since C++11, a
pair<>
using a type that has only a nonconstant copy constructor will no longer compile.
He then goes on to give the following example:
class A
{
public:
...
A( A& ); // copy constructor with nonconstant reference
...
};
std::pair<A, int> p; // Error since C++11
However, I'm interested in the reason that the standards committee decided to make this amendment to the standard library standard? I tried to google the reason, but was unsuccessful in finding anything pertinent.