Adding a read primitive to ranges
    Alex Parrill via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Mon May  4 08:16:24 PDT 2015
    
    
  
On Monday, 4 May 2015 at 00:07:27 UTC, Freddy wrote:
> Would it be a bad idea to add a read primitive to ranges for 
> streaming?
> ----
> struct ReadRange(T){
>     size_t read(T[] buffer);
>     //and | or
>     T[] read(size_t request);
>
>     /+ empty,front,popFront,etc +/
> }
> ----
IT seems redundant to me. It's semantically no different than 
iterating through the range normally with front/popFront. For 
objects where reading large amounts of data is more efficient 
than reading one-at-a-time, you can implement a byChunks function 
like stdio.File.
    
    
More information about the Digitalmars-d
mailing list