This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofTC1 status.
Section: 22.3[pairs]Status:TC1Submitter: Andrew KoenigOpened: 1999-08-03Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [pairs].
View all issues withTC1 status.
Discussion:
The claim has surfaced in Usenet that expressions such as
make_pair("abc", 3)
are illegal, notwithstanding their use in examples, because template instantiation tries to bind the first templateparameter to const char (&)[4], which type is uncopyable.
I doubt anyone intended that behavior...
Proposed resolution:
In 22.2[utility], paragraph 1 change the followingdeclaration of make_pair():
template <class T1, class T2> pair<T1,T2> make_pair(const T1&, const T2&);
to:
template <class T1, class T2> pair<T1,T2> make_pair(T1, T2);
In 22.3[pairs] paragraph 7 and the line before, change:
template <class T1, class T2>pair<T1, T2> make_pair(const T1& x, const T2& y);
to:
template <class T1, class T2>pair<T1, T2> make_pair(T1 x, T2 y);
and add the following footnote to the effects clause:
According to 12.8 [class.copy], an implementation is permitted to not perform a copy of an argument, thus avoiding unnecessary copies.
Rationale:
Two potential fixes were suggested by Matt Austern and DietmarKühl, respectively, 1) overloading with array arguments, and 2) use ofa reference_traits class with a specialization for arrays. AndyKoenig suggested changing to pass by value. In discussion, it appearedthat this was a much smaller change to the standard that the other twosuggestions, and any efficiency concerns were more than offset by theadvantages of the solution. Two implementors reported that theproposed resolution passed their test suites.