Boost logo

Boost Users :

Subject: Re: [Boost-users] Metaprogramming Question
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-02-09 23:09:06

On 2/9/2012 12:21 AM, Jeremiah Willcock wrote:

> Would it be reasonable for your use case to have MY_FANCY_ASSERT be:
> #define MY_FANCY_ASSERT(cond, str) \
> if (cond) {} else format(str) % __FILE__ % __LINE__
> or similar? It would restrict where you could use it, but would be simple and guarantee
> the properties you want.

I think suitable tricks, as being mentioned elsewhere on this thread, will make that kind
of thing work just fine for my needs.

The only issue is that I don't have anything inserted _after_ the %args. In particular, I
can't put a try/catch around them. Boost.Format throws exceptions if the arguments are
not good, and since this is for error message generation I want it to be fault-tolerant.
Really, what I want is to make the format more tolerant, and then this will work just
fine. I'll start a new thread on that.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at