This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] Implement LWG 2825, LWG 2756 breaks class template argument deduction for optional.


On Tue, Jan 31, 2017 at 8:48 AM Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
>
> On 31 January 2017 at 00:41, Ville Voutilainen
> <ville.voutilainen@gmail.com> wrote:
>
> I don't actually need to constrain it, I could just add a guide like
>
> template <typename _Tp> optional(optional<_Tp>) -> optional<_Tp>;
>
> However, I'm not convinced I need to. The preference to an explicit
> guide is, at least based
> on that paper, a tie-breaker rule. If the copy/move constructors are
> better matches than the guide,
> those should be picked over a guide. Jason?

Yes, but they are not "better matches". They are equally good matches
after deduction and substitution. The mechanism that selects
template<class T> void f(const optional<T>&) over template<class T>
void f(T) given an optional<int> argument is partial ordering, and
that's the last tiebreaker in the list, *after* the implicit/explicit
guide tiebreaker.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]