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.
Does it make sense to consider to a
On Fri, 16 Mar 2012 14:41:40 -0400, H. S. Teoh
wrote:
On Fri, Mar 16, 2012 at 02:30:25PM -0400, Steven Schveighoffer wrote:
[...]
I know this is already answered, but do you get a stack trace?
Shouldn't the second stack frame point to the offending line?
[...]
I didn't compile with debuggi
16.03.2012 20:35, H. S. Teoh пишет:
[...]
Actually, I found the solution: the compiler understands __FILE__ and
__LINE__ in compile-time arguments too, so this works: void
checkConsistency(string file=__FILE__, size_t line=__LINE__, T...)(T
args) { ... } It's a bit painful with the assert st
On Fri, Mar 16, 2012 at 02:30:25PM -0400, Steven Schveighoffer wrote:
[...]
> I know this is already answered, but do you get a stack trace?
> Shouldn't the second stack frame point to the offending line?
[...]
I didn't compile with debugging turned on, so it only showed a hex
address. Using compi
On Friday, 16 March 2012 at 18:31:58 UTC, Kevin Cox wrote:
But then you have to write it each time.
Nah, it just works, at least for the implicit calls:
checkConsistency(1, "2", 3); // calls checkConsistenct!(__FILE__,
__LINE__, int, string, int)(1, "2", 3);
On Fri, Mar 16, 2012 at 02:31:47PM -0400, Kevin Cox wrote:
> On Mar 16, 2012 2:29 PM, "Adam D. Ruppe" wrote:
> >
> > Put the string file = blaha in the template argument list,
> > before the variadic.
> >
> > voic checkConsistency(string file = __FILE__, int line = __LINE__,
> T...)(T t) {
> >
> >
On Fri, 16 Mar 2012 14:23:37 -0400, H. S. Teoh
wrote:
I'm writing some unittests with very repetitive tests for a myriad of
different types, so I wrote a helper function:
version(unittest) {
void checkConsistency(T...)(T args) {
foreach (a; arg
On Fri, Mar 16, 2012 at 08:26:30PM +0200, Mantis wrote:
> 16.03.2012 20:23, H. S. Teoh пишет:
> >I'm writing some unittests with very repetitive tests for a myriad of
> >different types, so I wrote a helper function:
> >
> > version(unittest) {
> > void checkConsistency(T...)(T args
On Mar 16, 2012 2:29 PM, "Adam D. Ruppe" wrote:
>
> Put the string file = blaha in the template argument list,
> before the variadic.
>
> voic checkConsistency(string file = __FILE__, int line = __LINE__,
T...)(T t) {
>
>
But then you have to write it each time.
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 thi
16.03.2012 20:23, H. S. Teoh пишет:
I'm writing some unittests with very repetitive tests for a myriad of
different types, so I wrote a helper function:
version(unittest) {
void checkConsistency(T...)(T args) {
foreach (a; args) {
I'm writing some unittests with very repetitive tests for a myriad of
different types, so I wrote a helper function:
version(unittest) {
void checkConsistency(T...)(T args) {
foreach (a; args) {
assert(isConsistent(a))
12 matches
Mail list logo