strip() and formattedRead()

Ali Çehreli acehreli at yahoo.com
Wed Mar 21 18:47:53 UTC 2018


On 03/21/2018 11:44 AM, realhet wrote:
>    float x,y,z;
>    if(formattedRead("    vertex -5.1 2.4 3.666".strip, "vertex %f %f 
> %f", x, y, z)){
>      writefln("v(%f, %f, %f)", x, y, z);
>    }

formattedRead wants to modify the source, so it takes it by reference, 
which rvalues cannot be passed for. Make the source an lvalue (i.e. a 
proper variable):

   auto source = "    vertex -5.1 2.4 3.666".strip;
   if(formattedRead(source, "vertex %f %f %f", x, y, z)){

Ali


More information about the Digitalmars-d-learn mailing list