C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Default arguments should participate in template argument deduction

From: Zhihao Yuan <zy_at_[hidden]>
Date: Wed, 30 Mar 2022 05:41:22 +0000
On Tuesday, March 29th, 2022 at 6:39 PM, Edward Catmur <ecatmur_at_[hidden]> wrote:

> > Are you sure about that: https://godbolt.org/z/PMT3GG56G
>

> Oh, nice. Still, relying on the optimizer virtualizing and inlining isn't always the best idea, and some optimizations (like constant folding, IIRC) don't make it across the function call boundary.

There is no "function call boundary"involved here. The reason that thiscode is inlined is as same as whya function template specialization isinlined. function_ref is built in a waysuch that, if the compiler can seeboth the callee to be erased andthe caller, there is no extraabstraction cost. If you observedan inferior codegen, the case mayworth looking into for the vendor.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2022-03-30 05:41:27