Bug 3436 – std.functional.compose with only one function
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-10-22T12:14:00Z
Last change time
2015-06-09T01:26:55Z
Keywords
patch
Assigned to
andrei
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2009-10-22T12:14:50Z
import std.functional, std.math;
alias compose!(sqrt) myCompose;
C:\dmd2\windows\bin\..\..\src\phobos\std\functional.d(474): Error: tuple index 0 exceeds 0
Only happens in the degenerate case of only passing one function to compose. Not a terribly severe bug, but might be annoying in some metaprogramming cases, and should ideally be fixed anyhow.
Fix: Around line 454, check for this as a special case.
static if(fun.length == 1) {
alias fun[0] doIt;
} else static if (fun.length == 2) {