This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++-concepts]
- From: Gabriel Dos Reis <gdr at axiomatics dot org>
- To: Andrew Sutton <andrew dot n dot sutton at gmail dot com>
- Cc: Jason Merrill <jason at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 May 2013 16:29:09 -0500
- Subject: Re: [c++-concepts]
- References: <CANq5Syt-902T3fhzsZ1uAaVyb-CuUue0jtMM4QhBE0Dw34i0iw at mail dot gmail dot com> <87wqqge1cn dot fsf at euclid dot axiomatics dot org> <CANq5SytYGZMHy0LgoeVzrMMUwJc+rskyZisioypPOwL_aY5NDg at mail dot gmail dot com> <51A7B7DB dot 5090400 at redhat dot com> <CANq5SysNs7N8XS=kjpWZoKUP=-mLqRjH957z_BZ2U=ANW=YmMg at mail dot gmail dot com>
Andrew Sutton <andrew.n.sutton@gmail.com> writes:
| I presented that at C++Now, so I hope so :) It lets me write:
|
| template<typename T>
| requires Input_iterator<T> // no parens!
| void f(T x);
|
| Walter Brown also suggested this usage in his object alias paper.
|
| In concepts lite, a concept is essentially an expression. Thus far,
| we've packaged those expressions in constexpr functions (using
| "concept" as a declaration specifier to impose additional
| restrictions). Variable templates fall easily into this same set of
| restrictions. Plus, no overloading.
In this scenario, Input_iterator<T> (my prefered syntax!) is a constant
expression (or will be a constant expression.) The real question is
whether we need yet another way of declaring a constexpr variable
template. I have not made up my mind on that, but I am leaning
towards "no".
So, we do need a comment in the code about this flag.
-- Gaby