Capturing caller's file/line number in variadic template functions
Adam D. Ruppe
destructionator at gmail.com
Fri Mar 16 11:26:47 PDT 2012
On Friday, 16 March 2012 at 18:21:54 UTC, H. S. Teoh wrote:
> void checkConsistency(T...)(T args, string file=__FILE__,
> size_t line=__LINE__) { ... }
>
> but this causes compile errors because when C==string, then the
> call is
> ambiguous.
>
> Is there an easy of working around this?
Put the string file = blaha in the template argument list,
before the variadic.
voic checkConsistency(string file = __FILE__, int line =
__LINE__, T...)(T t) {
More information about the Digitalmars-d-learn
mailing list