http://d.puremagic.com/issues/show_bug.cgi?id=9589
Summary: Add hasEmpty template to std.range Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: andrej.mitrov...@gmail.com ReportedBy: andrej.mitrov...@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2013-02-25 16:13:37 PST --- In one of my templated functions I've misused the hasLength template to figure out if I can call ".empty" on a type: void add(E elem) { static if (hasLength!E) if (elem.empty) return; // do something with 'elem' } Unfortunately this won't work with strings because hasLength returns false for strings (it's deliberate, but I missed this part of the docs). Anyway the proper template I should use is 'hasEmpty', which is missing from phobos. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------