using std.algorithm.topN with std.range.zip fails with undefined swap
Nikhil Padmanabhan
nikhil.padmanabhan at gmail.com
Mon Dec 16 18:56:43 PST 2013
(apologies in advance if this posts multiple times, I messed up the sending
email address the first time).
Hi,
Trying to compile :
import std.stdio, std.range, std.algorithm;
void main() {
auto a = [2.0,1.0,3.0];
struct Point {
double x;
}
auto b = [Point(4.0), Point(5.0), Point(6.0)];
topN!("a[0] < b[0]")(zip(a,b),1);
//sort!("a[0] < b[0]")(zip(a,b));
writeln(a,b);
}
std/algorithm.d(8225): Error: template std.algorithm.swap does not match
any function template declaration.
Swapping out topN with sort works just fine. I assume both sort and topN
use swap, is there a reason this doesn't work with topN?
Thanks in advance,
-- Nikhil
---------------------------------
Nikhil Padmanabhan
nikhil.padmanabhan at yale.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131216/91387fc0/attachment-0001.html>
More information about the Digitalmars-d-learn
mailing list