Boost logo

Boost :

Subject: Re: [boost] Checking for return type -- BOOST_STATIC_ASSERT?
From: Edward Grace (ej.grace_at_[hidden])
Date: 2009-08-21 07:25:47


On 20 Aug 2009, at 23:57, Scott McMurray wrote:

> 2009/8/20 Edward Grace <ej.grace_at_[hidden]>:
>>
>> if O is compatible with the concept of a functor and O returns a
>> type that
>> can be converted to a float, then we are good to go -- otherwise
>> I'd like an
>> intelligible error.
>>
>> If, for example, O is of the type 'void (*)()' I'd like it (the
>> compiler) to
>> spit out,
>> "The function pointer of type O must of signature float (*)()"
>>
>
> Sounds like you want something like the MPL_ASSERT example at [1]
> along with the result_of metafunction[2].
>
> [1] http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/
> assert.html
>
> [2] http://www.boost.org/doc/libs/1_39_0/libs/utility/
> utility.htm#result_of

Sorted! It turns out that the other problem I was having as also not
including is_same.hpp....

Thanks for the pointers (excuse the C pun).

Curiously, littering my code with these assertions has now
highlighted some (genuine) wrinkles that I hadn't spotted before.

Regards,

-ed

------------------------------------------------
"No more boom and bust." -- Dr. J. G. Brown, 1997


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