Topic: [std-proposals] [c++std-core-27204] Re:
Author: Tom Honermann <thonermann@coverity.com>
Date: Fri, 6 Mar 2015 14:26:19 -0500
Raw View
On 03/06/2015 01:01 PM, Nicol Bolas wrote:
> The question there is why you need to "syntactically determine if a
> function definition is a template or not"? Why do you care? If the
> compile-time difference is negligible, and you don't need to get a
> function pointer to it, why would you need to know whether it's a
> template or not?
Because this:
void f(X&& x) {}
may be called with an rvalue or lvalue argument if X is a concept, but
may only be called with an rvalue if X is a type. That may be important
to a library interface.
And because this:
void f(X x) {
static int invoke_count;
++invoke_count;
}
will maintain a count of either every invocation of f() or every
invocation of an instantiation of f() depending on whether X is a
concept or not.
And because this:
void f(X x) {}
may be moved from a primary source file to a header if X is a concept,
but not if X is a type.
And because this:
void f(X x) {
X::type t;
}
will require 'typename' if X is a concept, but will not allow it if X is
not (of course, the compiler will be happy to tell me about this one).
Why do I care about the above? Because, in a large code base that I'm
not familiar with, having to go find out what X is detracts from getting
the work done.
Tom.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-discussion@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.
.