What does C++ do better than D? - StackOverflow.com

Adam Ruppe destructionator at gmail.com
Mon Aug 1 16:30:38 PDT 2011


Peter Alexander wrote:
> 1. The fact that you can't copy const struct objects containing
> reference types.

I recently hit a similar problem. web.d uses a ParameterTypeTuple
to fill in arguments to the functions it calls in a generic way.

With "in" arguments, assigning to the tuple isn't allowed! It says
"can't modify const".

I decided to just not use const in there, and cast it away in the
wrapper function. I'm not happy with that, but I don't know what else
to do. (I generally like D's const and immutable, but blarg there are
some rough edges and I don't even know how to fix the design.)


More information about the Digitalmars-d mailing list