Boost logo

Boost :

Subject: Re: [boost] is_range metafunction
From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2008-10-08 21:17:29


On Tue, Oct 7, 2008 at 3:06 PM, Joel Falcou <joel.falcou_at_[hidden]> wrote:
> Daniel Walker a écrit :
>>
>> Of course, I think there is a need to package SFINAE techniques as a
>> nice library for compile-time class-based type introspection -
>> something beyond MPL's HAS_XXX. I've done some work on this myself,
>> actually, and I once submitted a patch implementing HAS_XXX for member
>> templates, but I believe it got lost in the SVN migration. This is
>> another topic that doesn't relate to is_range, but yeah, sure, if you
>> have something along these lines, by all means, share it! ;-)
>>
>
> Yeah we kinda miscommunicated on this topic. I'll gather what I have and see
> what is worth sharing.
> basically, what I tried to do was a generic
>
> BOOST_HAS_METHOD_NAMED(foo, (int,int))
>
> that check for presence of a given method with a given prototypes in types
> with variations to catch or not to catch
> const version of a named methods etc. The code is rather simple IIRC as it's
> roaming the internet since ages but
> never put into a proper usable macro I think.

That sounds great. Nice that you handle constness. I would suggest
adding support for volatility, as well, but yeah, sounds good so far.

> I also think we can check what's needed for this and how to put it properly.
> If you think it's worth, maybe we should start
> a new topic and work over this.

Sure! If you have member functions, I have member templates, and
member types are already in MPL, then all we lack are macros for
member data and member function templates. I would suggest naming the
complete set of class-based introspection macros like so:

BOOST_HAS_MEMBER_DATA
BOOST_HAS_MEMBER_TYPE
BOOST_HAS_MEMBER_TEMPLATE
BOOST_HAS_MEMBER_FUNCTION
BOOST_HAS_MEMBER_FUNCTION_TEMPLATE

And of course, if expression SFINAE gets ironed out soon, we could go
ahead and add BOOST_HAS_EXPRESSION and perhaps some metafunctions in
support of concept-based introspection... or maybe a better term for
it would be expression introspection. But one step at a time...

Why don't we both package what we have, upload to vault, and then work
out merging the two and adding the rest in another thread?

Daniel Walker


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