Boost logo

Boost :

Subject: Re: [boost] [metagraph]
From: Abel Sinkovics (abel_at_[hidden])
Date: 2012-02-03 02:11:35


Hi Gordon,

>
>> The do and let notations are general tools for monads - if you need exception propagation only, there is another utility for that in metamonad: the try_ template (http://abel.web.elte.hu/mpllibs/metamonad/try_.html). Instead of writing
>>
>> template<class T1, ..., class Tn>
>> struct my_metafunction : body {};
>>
>> you write
>>
>> template<class T1, ..., class Tn>
>> struct my_metafunction : try_<body> {};
>> and it instruments body to propagate errors.
> If body calls another metafunction then does that one have to be instrumented too?

Yes. If body calls another metafunction, that has to be instrumented too
(or be prepared for handling exceptions). When a metafunction "throws"
an exception, every metafunction in the "call-chain" needs to be
instrumented until the point the exception is handled. When an exception
is propagated to a metafunction that is not instrumented, it causes a
compilation error. Instrumentation guarantees that no metafunctions in
the instrumented expression are called with exceptions as their arguments.

Regards,
   Abel


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