makeIndex not working

Johann MacDonagh johann.macdonagh..no at spam..gmail.com
Sat Jul 2 17:15:33 PDT 2011


I'm confused, what am I doing wrong here? This example came from the 
std.algorithm documentation.

import std.algorithm;

void main()
{
     immutable int[] arr = [ 2, 3, 1, 5, 0 ]; // index using pointers
     auto index1 = new immutable(int)*[arr.length];
     makeIndex!("a < b")(arr, index1);
}

Error is:

main.d(7): Error: template std.algorithm.makeIndex(alias less = "a < 
b",SwapStrategy ss = SwapStrategy.unstable,Range,RangeIndex) if 
(isForwardRange!(Range) && isRandomAccessRange!(RangeIndex) && 
is(ElementType!(RangeIndex) : ElementType!(Range)*)) does not match any 
function template declaration
main.d(7): Error: template std.algorithm.makeIndex(alias less = "a < 
b",SwapStrategy ss = SwapStrategy.unstable,Range,RangeIndex) if 
(isForwardRange!(Range) && isRandomAccessRange!(RangeIndex) && 
is(ElementType!(RangeIndex) : ElementType!(Range)*)) cannot deduce 
template function from argument types !("a < 
b")(immutable(int[]),immutable(int)*[])
main.d(7): Error: template instance errors instantiating template


More information about the Digitalmars-d-learn mailing list