Operate with void[]
    Adam D. Ruppe 
    destructionator at gmail.com
       
    Tue Jan 14 19:11:26 PST 2014
    
    
  
On Wednesday, 15 January 2014 at 02:58:50 UTC, Sergey wrote:
> And then back to void[] write to a file?
That's done automatically - any array will implicitly cast to 
const(void)[].
If you're writing a function that can take any kind of data, for 
example, std.file.write, it is nice to take a const void[] since 
then you can pass anything to it:
write("myfile", "a string"); // ok
write("myfile", [0, 1, 2,3]); // ok
and so on.
Going from void[] to any other array requires a cast, since it 
needs to know what kind of data you want to look at (void has no 
meaning itself, so indexing it would be nonsense), but going from 
something else to void happens implicitly.
    
    
More information about the Digitalmars-d
mailing list