Is there any real reason to use "const"?

Walter Bright newshound2 at digitalmars.com
Mon Jan 24 21:51:11 UTC 2022


On 1/24/2022 12:09 PM, H. S. Teoh wrote:
> Makes me curious: how feasible is it to have functions with identical
> bodies merge together as well? This would help reduce template bloat
> when you have e.g. a templated type where a bunch of functions are
> identical because they either don't depend on the type (e.g. a container
> method that doesn't care about what type the payload is), or else depend
> on type traits that are common across many types (e.g., int.sizeof which
> is shared with uint.sizeof, float.sizeof, etc.).

It's quite feasible. I've considered adding that optimization many times.


More information about the Digitalmars-d mailing list