Boost logo

Boost :

Subject: Re: [boost] [TypeTraits] Type traits for member pointers?
From: Celtic Minstrel (celtic.minstrel.ca_at_[hidden])
Date: 2009-07-20 00:39:26


On Fri, Jul 17, 2009 at 2:55 PM, Steven Watanabe<watanabesj_at_[hidden]> wrote:
> void (Q::*)(int) const is a legal type.
> void(int) const is not.

Ah yes, that's true. Still, wouldn't it work just as well if it were
specialized for cv-qualified
member function types but not for the cv-unqualified form?

On Fri, Jul 17, 2009 at 3:02 PM, Jeffrey Hellrung<jhellrung_at_[hidden]> wrote:
> As far as decomposing member function pointers, is
> http://www.boost.org/doc/libs/1_39_0/libs/function_types/doc/html/index.html
> what you're looking for?

Apparently. Thanks. I have no idea how I missed that.

I think I even looked at that page awhile ago, actually...

(Is that intended to replace the function_traits template in the
TypeTraits library?)

Anyway, I'd like to point out that the member_object.hpp header linked to by
John Maddock is not actually what the tracking ticket he also linked
to was asking for.
It seems pretty clear to me that whoever posted that wanted something
more like this:

template<class T> struct remove_mem_ptr {
    typedef T type;
};
template<class T, class In> struct remove_mem_ptr<T In::*> {
    typedef T type;
};

template<class T, class In> struct add_mem_ptr {
    typedef T In::*type;
}; // (for completeness...)

(Evidence: the person who posted that ticket said this:
> Can boost::remove_pointer<T> be modified to work with
> pointers-to-member (data), too? For instance: remove_pointer<int *>
> returns the int type, but so should remove_pointer<int std::div_t::*>.
...implying that he wants remove_pointer<int std::div_t::*> to return
int, not std::div_t.
And member_object<int std::div_t::*> would return std::div_t.)

--SPCD
"Celtic Minstrel"


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