[Issue 9016] New: swap() doesn't work with std.container.DList.front and back
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 12 20:31:04 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9016
Summary: swap() doesn't work with std.container.DList.front and
back
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-11-12 20:31:03 PST ---
std.container.DList supports a manually written swap of its front and back
items, but it seems std.algorithm.swap() on them is not supported:
import std.stdio, std.algorithm, std.container;
void main() {
auto L = DList!int([10, 20, 30]);
writeln(L[]); // [10, 20, 30]
auto aux = L.front;
L.front = L.back;
L.back = aux;
writeln(L[]); // [30, 20, 10]
//swap(L.front, L.back);
}
If you uncomment the swap dmd 2.061alpha gives:
test.d(9): Error: template std.algorithm.swap does not match any function
template declaration
...\dmd2\src\phobos\std\algorithm.d(1767): Error: template std.algorithm.swap
cannot deduce template function from argument types !()(int,int)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list