"is not an lvalue" when passing template function to spawn function

Bienlein fm2002 at web.de
Wed Nov 8 16:30:49 UTC 2023


Hello,

I get the error "`addToBiz(T)(Biz!T biz)` is not an lvalue and 
cannot be modified" when compiling the code below. Can't find a 
way how to do it right. Am a D newbie and would appreciate some 
help.

Thank you, Bienlein



class Biz(T) {

         private T value;

         this(T value) {
             this.value = value;	
         }

}

     static void addToBiz(T)(Biz!T biz)
     {
         // ...
     }


     int main()
     {
         auto biz = new Biz!int(123);
         spawn(&addToBiz, biz);
     }




More information about the Digitalmars-d-learn mailing list