Created on 2016-11-15.00:00:00 last changed 96 months ago
[ 2017-01-27 Telecon ]
NAD
[ 2016-12-21, Jonathan comments and reommends NAD ]
Tim Song pointed out that this constructor isn't ambiguous, and I can no longer reproduce the errors I was getting, so I think this issue should be resolved NAD. The code snippet in the issue discussion compiles OK without the proposed change.
The new constructor added for LWG 2742 causes an ambiguity when attempting to construct from a (non-const) char*
char s[] = "whoops"; std::string str(s, 2, 4);
This is the same problem discussed in 2758, and the fix is the same: disable that new constructor if T is convertible to const_pointer, so that the old constructor is used instead.
Previous resolution [SUPERSEDED]:
This wording is relative to N4606.
Modify the new basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); constructor in [string.cons] as shown:
template<class T> basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator());-?- Effects: Creates a variable, sv, as if by basic_string_view<charT, traits> sv = t; and then behaves the same as:
basic_string(sv.substr(pos, n), a)-?- Remarks: This constructor shall not participate in overload resolution unless is_convertible_v<const T&, basic_string_view<charT, traits>> is true and is_convertible_v<const T&, const charT*> is false.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-01-30 15:17:53 | admin | set | messages: + msg8799 |
2017-01-30 15:17:53 | admin | set | status: new -> nad |
2016-11-26 19:54:12 | admin | set | messages: + msg8688 |
2016-11-15 00:00:00 | admin | create |