Immutable objects and constructor ?

chmike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 21 03:44:49 PDT 2016


On Saturday, 21 May 2016 at 08:24:19 UTC, Ali Çehreli wrote:
> On 05/21/2016 01:07 AM, chmike wrote:
> > Unfortunately it is not possible to write this
> >
> > import std.typecons;
> > class Info{...}
> > rebindable!Info x;
>
> You have a capitalization typo. Rebindable is a type template, 
> rebindable is a function template.
>
> import std.typecons;
> class Info{}
>
> void main() {
>     auto x = rebindable(new immutable(Info)());
>     pragma(msg, typeof(x));
>
>     auto y = Rebindable!(immutable(Info))(new Info());
>     pragma(msg, typeof(y));
> }
>
> Ali

Thank you. I'll start a new thread with the subject "problems 
with Rebindable".
See 
https://forum.dlang.org/post/bprfdptcvzzkfzxlhflb@forum.dlang.org


More information about the Digitalmars-d-learn mailing list