This is the mail archive of the gcc@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] | |
Hopefully. From my point of view the class generated by a lambda expression should be equivalent to something you
could write yourself -- aside from the single stack-pointer reference optimization which only a compiler could achieve
-- the class has a name, albeit invisible to the user (except in errors/warnings), and instances of should be useable
just as if there were user-defined functors. I'm sure there are things I've overlooked but hopefully this
proof-of-concept will help to allay people's fears.
Makes sense. I suppose to specify explicit template arguments users would have to write
lambdaob.operator()<template-arg>(fn-arg)
That would be the case for explicit instantiation yes. With my implementation you could only get such as nullary
function template if you explicitly specified the template parameters and explicitly specified an empty call argument
list. I've made the template parameter list optional within the already optional lambda-parameter-declaration. If
present, it has to be followed by a function parameter list. The intent of course is that any template parameters
will be referenced in the function parameter list. Though it does not prevent having unreferenced template parameters
that would need to be explicitly bound.
Since templates work so differently from normal functions, I'm a little
uncomfortable with the idea of templates that don't involve any template
syntax, just the use of auto in the parameter list. But I'm open to
giving it a try, at least in the lambda context. Maybe outside of
lambda it could be used with a small template introducer...
[snip] The benefit
of using it in lambdas is that the call operator is never 'seen', so whether its a template or not shouldn't affect
the caller providing the input arguments are compatible.
so we'd really expect them to be only deduced.Yes.
I am not up to speed with the issues but they obviously exist. One thing I don't understand, and perhaps you couldWhen I last left the discussion, the biggest issue in my opinion was concept map dropping. The workaround made the deduction algorithm intimidatingly complex.
help, is that whatever issues polymorphic lambdas have -- surely manually written function objects with template call
operators have the same issues. Is this true?
And if so does it mean that future standard library algorithms will be
more constraining than exisiting ones -- or am I barking up the wrong tree?
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |