varid takes one argument which must be a named variable or reference and returns the compiler-specific index of the variable, of type std::size t. The operator name would introduce a new keyword into the language. Listing 5 presents valid use cases. In particular, the capacity to ‘trace though’ from a reference to a definition is key requirement. If such functionality were omitted, there would be no way to write expression node construction functions, like the one presented in Listing 4.
```float c0;
float c1;
static_assert(varid(c0) != varid(c1));
auto &cr = c0;
static assert(varid(cr) == varid(c0));
cr=c1;
static assert(varid(cr) == varid(c1));
```
On Dec 22, 2020, at 10:42 AM, Dominic Jones via SG7 <sg7@lists.isocpp.org> wrote:--> So this is basically a missing piece of functionality for expression-template-based solutions for automatic differentiation?Yes, I would say so. It is the minimum requirement needed for writing an automatic differentiation tool that produces highly efficient object code.On Tue, 22 Dec 2020 at 00:41, Ville Voutilainen <ville.voutilainen@gmail.com> wrote:On Tue, 22 Dec 2020 at 01:43, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> 1) What do you use to solve such problems today?
> 2) Would the introduction of this language facility perhaps, vaguely
> guessing at a possible answer to (1), to be able to
> avoid using a compiler-specific solution or a custom parser?
>
> A further remark: we are yet fairly far from being able to introspect
> and analyze function bodies, sequences of statements
> and expressions, that is. Based on a brief look at the talk this might
> fall into that bucket that we hope to get at later
> on, but perhaps there's something about the answer to the question (1)
> above that makes this more straightforward
> than full expression/statement-reflection?
Ha, having seen all of the talk, I may have gotten quite a bit ahead
of things there. So this is basically
a missing piece of functionality for expression-template-based
solutions for automatic differentiation?
SG7 mailing list
SG7@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg7