Boost logo

Boost :

Subject: Re: [boost] [Review] TTI
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-27 13:52:15

On Wed, Jul 27, 2011 at 7:16 AM, Edward Diener <eldiener_at_[hidden]>wrote:

> On 7/26/2011 5:58 PM, Jeffrey Lee Hellrung, Jr. wrote:
>> On Tue, Jul 26, 2011 at 2:25 PM, Edward Diener<eldiener_at_[hidden]**
>> >wrote:
>> On 7/26/2011 5:03 PM, Jeffrey Lee Hellrung, Jr. wrote:
>>> On Tue, Jul 26, 2011 at 1:19 PM, Noah Roberts<roberts.noah_at_[hidden]**
>>>> **
>>>>> wrote:
>>>> [...]
>>>> One thing that I think is missing is the option to check for a named
>>>>> callable within a type. For example, one might want to use enable_if
>>>>> style
>>>>> concept checking. So long as a type has function 'xxx' that takes
>>>>> arguments
>>>>> of type x,y,and z, and returns something convertible to type A, the
>>>>> concept
>>>>> is obeyed. I don't believe this can be done with C++03, but with C++1X
>>>>> I
>>>>> was able to do something using decltype.
>>>>> [...]
>>>> Actually, you can approximate it pretty well in C++03 (using derivation
>>>> and
>>>> using tricks) to the point that I think it will work pretty much as you
>>>> expect except for nullary member functions, where your queries must be
>>>> more
>>>> restrictive. This is a useful query, but I believe Edward has decided
>>>> it
>>>> to
>>>> be outside the scope of TTI.
>>> I am not sure what the OP means by 'named callable". If it can be
>>> introspected within the type I can consider whether it can be done or
>>> not.
>> I think you missed the convertibility requirement(s).
> TTI needs an exact signature.

...and hence why I had presumed it to be outside of the scope of TTI. It
stills falls within the domain of introspection, though.

> This is something more along the lines of Frederic Bron's Type Traits
>> Extension, I think.
> That deals with operators for a type in general. I have a feeling that the
> OP was interested in determining whether a class was a function object for
> some parameter(s).

Frederic's framework is not really specific to operators, per se. For
example, I believe his techniques could be used to detect whether a free
function would be found via ADL. The proposed Type Traits Extension is all
about "can you call operator X with arguments Y with result convertible to
Z?". It's not such a large leap to ask the same question about a member

- Jeff

Boost list run by bdawes at, gregod at, cpdaniel at, john at