This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++-concepts] code review
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Jason Merrill <jason at redhat dot com>, Gabriel Dos Reis <gdr at axiomatics dot org>
- Cc: Andrew Sutton <andrew dot n dot sutton at gmail dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Jun 2013 19:29:00 -0500
- Subject: Re: [c++-concepts] code review
- References: <CANq5Syt5s-NgazOYbT5wtYSRsbZUqcivoer1w4jiucx5qYKMfA at mail dot gmail dot com> <CAAiZkiAn9rpPmPKXztUA4rd3CH6w3=tn7jz=oksk65Ypx6RpGg at mail dot gmail dot com> <51B0B0ED dot 5090508 at redhat dot com> <CANq5SystWWs=AOAYAHmRjfx17itDrYQj+GtdUr=-XYGLV_4=6g at mail dot gmail dot com> <51B0F122 dot 6020301 at redhat dot com> <CANq5SysFjY39osn-Xp3HXE-Due7C=D2-VKrhjKdLtpws8rH=mg at mail dot gmail dot com> <51B62961 dot 1080409 at redhat dot com> <CAAiZkiDY5LZRwgEAmc1VPhbMXJ1ytU_Q2Fj9tSyN1M_T7NMMfw at mail dot gmail dot com> <51B8A36C dot 1080005 at redhat dot com> <CANq5SyuWOKxWshSBb8uxtN8d6HMgifJdDcQSrsSwazRjE=v2NQ at mail dot gmail dot com> <51BBC613 dot 5040708 at redhat dot com> <CANq5SysgoJ0nVdrqLMjFqaWcmz97dB03qbKCs_ZpoBS+OVYzfg at mail dot gmail dot com> <51BF617D dot 3080101 at redhat dot com>
On Mon, Jun 17, 2013 at 2:20 PM, Jason Merrill <jason@redhat.com> wrote:
>> I have not thought deeply about constrained friend declarations. What
>> would a friend temploid look like?
>
>
> I was thinking something like
>
> template <class T> struct A {
> T t;
> requires Addable<T>()
> friend A operator+(const A& a1, const A& a2)
> { return A(a1.t + a2.t); }
>
> };
We agreed about a month ago to have something like this
for member functions. It makes sense that it applies to friend
too (since it already applies to static member functions.)
One caveat in the design is that the nested requirement can
only add to the outer requirements.
-- Gaby