Date: Tue, 27 Aug 2024 11:53:23 +0200
Interesting, did not know that. Could not get your exact code to work, but
the following snipped did:
```cpp
template <auto> auto benchmark = 0;
template <> auto benchmark<[]{}> = do_stuff(1);
template <> auto benchmark<[]{}> = do_stuff(2);
template <> auto benchmark<[]{}> = do_stuff(3);
```
(compiler explorer link:
https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGISQCcpK4AMngMmAByPgBGmMQgZgBspAAOqAqETgwe3r566ZmOAmER0SxxCWZctpj2xQxCBEzEBLk%2BfoG19dlNLQSlUbHxiSkKza3t%2BTXj/YPllYlcAJS2qF7EyOwcJhoAguYAzOHI3lgA1CaHbk7jxJisV9i7B/tHWDQR5wAiAPIA%2BkIABK/ABKABU3HJwecNC8XncvA5zuhUP9xl4qFRLgB2Kz7c6E87hAjE/5XfF7IkotEYrEQEnE5bnEBkhnMkx4l7U6njdAgFDrUlXNwiy5mMxoBiIhyYdDisyXa5ivD/JWi67nMA7ACsbgY2op3KJnO%2BxsJAD9UeiCJiqBAOVyCTzCXyBWgvMLlZrzGYsDKCHKFeqVWqRWLDXqDTtDpTqab4TizbH4ftAyxUgZA%2BrGQQAJJPF5MT2oc4sACe/wAbi0FErvrCjW805gM1nMCHDs99sWiGXKzXiAoRVwnvWaTa7RANMsm689unM0xsyLe6gx2vznEGMgECwWgBrcdwlPNhetpcr73Yc6b7e7/fEA/hnVWHVmrlJsfj610%2B0rOdF3bTsbzvRgH0PF83w/Kwvy7QkrgbX9bXpMxZ1Pc822XDtw3gsCdz3SDlVfEx305WDkxvH9aRQ%2B1DnQykXkZfdwgZQRiVIc5dxaAAqHiuMdOMiTwe08HVc5JEE80eXuW1iAYc5Rww%2BMv2dQkAHp1POPtGAUDYOwIBBl3OAB3DsjKrAyEA7Qc8CYGJ6Dr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EqHUL42BpATJ71SOfTx3j6l%2BwDr8T03TSSoGxKM0J4TInRKkPEoWHgBnEFSek1pk9lirGsj5EYDovY%2B1IGfMwgTYlJBxJIQ4OouA6lqRoKQVTpANJNpwZpodn7ZI9l7Q4PjGnoq%2BVkr2Zh8VosDkSl2pBL6ZGcJIIAA%3D%3D
)
// Robin
On Tue, Aug 27, 2024 at 7:55 AM Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Monday 26 August 2024 22:43:19 GMT-7 Robin Savonen Söderholm via Std-
> Proposals wrote:
> > template <int>
> > auto _benchmarks = 0;
> > #define BENCHMARK(fn) \
> > auto _benchmarks<counter()> =
> > (::benchmark::internal::RegisterBenchmarkInternal(#fn, fn));
>
>
> template <auto> auto benchmark;
>
> template auto benchmark<[]{}> = ( register1(): }
> template auto benchmark<[]{}> = ( register2(): }
> template auto benchmark<[]{}> = ( register3(): }
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
the following snipped did:
```cpp
template <auto> auto benchmark = 0;
template <> auto benchmark<[]{}> = do_stuff(1);
template <> auto benchmark<[]{}> = do_stuff(2);
template <> auto benchmark<[]{}> = do_stuff(3);
```
(compiler explorer link:
https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGISQCcpK4AMngMmAByPgBGmMQgZgBspAAOqAqETgwe3r566ZmOAmER0SxxCWZctpj2xQxCBEzEBLk%2BfoG19dlNLQSlUbHxiSkKza3t%2BTXj/YPllYlcAJS2qF7EyOwcJhoAguYAzOHI3lgA1CaHbk7jxJisV9i7B/tHWDQR5wAiAP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j%2BgEmAKQzD4OhAyHSgYj9mJwhaPzjdIIvmGIctfhibRMAcTgHZTthBF%2BBhaFLrRSCwGIvGANwxFoYOy6wfcjHEcPeHwe4HDwSzh67zBVHrz1ti7kk6j92g8BiYgS48LA/YIYg8BYRveEs4gYhc75W0MYBt6MZ3VioAxgAUAA1PBMBM35UkYc%2BMhBAiDEOwKQQD5BKDUH7XQNQDBP1MBbSw%2Bgd7B0gKsVAqQGjDwALS/ByjgvkiFEFWEsGYGI5wcFUClFsLBCgcH4CYMABgGR4b0KwFghAiEDb%2B0viff08BVh2Hrg0FwHkph%2BBqKEcIQwKgjBqIULIAgJEFAyEohg8xhgJBmHUERvQJhtE8B0PQwjZ4CD6K0TRcjtG2AMSomYBirGLBWGsDYWwJCrFoPrX2k9/acHOKoAAHEkHBSRJDnGAMgZAilJAADpFQQFwIQEg4pDgrF4GHCOrt3aey8d7XgZ8cRcFiYcMwOowmBMkFIAIgTymkCNl3AOQcQ6O2fqQKOschSpE9EnI6qBU7xEiKwbYQSQlhIiVExShxYkOzlMk/heh%2BDANEOIcBSzIEqHUL42BpATJ71SOfTx3j6l%2BwDr8T03TSSoGxKM0J4TInRKkPEoWHgBnEFSek1pk9lirGsj5EYDovY%2B1IGfMwgTYlJBxJIQ4OouA6lqRoKQVTpANJNpwZpodn7ZI9l7Q4PjGnoq%2BVkr2Zh8VosDkSl2pBL6ZGcJIIAA%3D%3D
)
// Robin
On Tue, Aug 27, 2024 at 7:55 AM Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Monday 26 August 2024 22:43:19 GMT-7 Robin Savonen Söderholm via Std-
> Proposals wrote:
> > template <int>
> > auto _benchmarks = 0;
> > #define BENCHMARK(fn) \
> > auto _benchmarks<counter()> =
> > (::benchmark::internal::RegisterBenchmarkInternal(#fn, fn));
>
>
> template <auto> auto benchmark;
>
> template auto benchmark<[]{}> = ( register1(): }
> template auto benchmark<[]{}> = ( register2(): }
> template auto benchmark<[]{}> = ( register3(): }
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2024-08-27 09:53:53