January 25, 2007 Tuple Arguments - Type or Constant? | ||||
|---|---|---|---|---|
| ||||
Tuples allow either types or constants to be used as arguments. template tuple(T...); tuple!(int, 35); Is there any way to safely tell if a tuple argument is a type or a constant without getting an error from the compiler? | ||||
January 25, 2007 Re: Tuple Arguments - Type or Constant? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Xinok | "Xinok" <xnknet@gmail.com> wrote in message news:ep91ad$sno$1@digitaldaemon.com... > Tuples allow either types or constants to be used as arguments. > > template tuple(T...); > tuple!(int, 35); > > Is there any way to safely tell if a tuple argument is a type or a constant without getting an error from the compiler? If you use std.typetraits, there is a metafunction isExpressionTuple(). If that returns true, then it's constants; otherwise, it's, well, I guess any mix of types and expressions. But hopefully just types. (this is kind of an ugly thing with tuples, no?) | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply