[Issue 13793] New: @nogc std.algorithm.count(std.range.only)
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sat Nov 29 05:19:58 PST 2014
    
    
  
https://issues.dlang.org/show_bug.cgi?id=13793
          Issue ID: 13793
           Summary: @nogc std.algorithm.count(std.range.only)
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc
I think this doesn't need to allocate heap memory:
void main() @nogc {
    import std.algorithm: count;
    import std.range: only;
    int[] a;
    auto r = a.count(only(0, 1));
}
dmd 2.067alpha:
test.d(5,21): Error: @nogc function 'D main' cannot call non- at nogc function
'std.algorithm.count!("a == b", int[], OnlyResult!(int, 1u)).count'
--
    
    
More information about the Digitalmars-d-bugs
mailing list