Boost logo

Boost :

From: Thomas Wenisch (twenisch_at_[hidden])
Date: 2003-05-02 12:03:17


On Fri, 2 May 2003, John Torjo wrote:

> > [from Samuel Krempp]

[snip]

> > now we get an alternative to John Torjo's smart_assert :
> >
> > > assert( (i < j) || (i == 0) || (j == 1) ); would change into
> > > SMART_ASSERT( (v_(i) < v_(j)) || (i == 0) || (j == 1) );
> >
> > INVARIANT( (i < j) || (i == 0) || (j == 1)) (i) (j) ;
> >
>
> This would look incredibly cool!
> However, I spent some time, and I don't know how to implement it.
>

[snip]

>
> However, just using (i) (j) I'm not sure we can do this. I may be wrong, but
> this should not work:
>
> #define OP1(x) std::cout << #x << "=" << (x) << std::endl;
> #define OP2(x) std::cout << #x << "=" << (x) << std::endl; OP1
>
> Then, the question is, will 'OP2(i)(j)' output the values of i and j?

I suggest you check with Paul Mensonides on how to make this (i)(j) syntax
possible. This looks similar to the PP library's sequence data structure
to me (same kind of problems). If it can be done, I am sure he can tell
you how.

Best Regards,
-Tom Wenisch
Computer Architecture Lab
Carnegie Mellon University


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk