Boost logo

Boost :

Subject: Re: [boost] [Review] Type Traits Introspection library by Edward Diener starts tomorrow Friday 1
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-07-05 16:09:30


On 7/5/2011 4:38 AM, John Maddock wrote:
> OK here's my review of this library.
snipped...
>
> 12) Testing BOOST_TTI_HAS_COMP_MEMBER_FUNCTION(begin)
>
> I see that this static assertion fails:
>
> BOOST_STATIC_ASSERT((boost::tti::has_comp_member_function_begin<std::vector<int>::const_iterator
> (std::vector<int>::*const)(void)>::value));

Investigating this I find out that the form that function_types
generates, which is what BOOST_TTI_HAS_MEMBER_FUNCTION uses, is:

std::vector<int>::const_iterator (std::vector<int>::* )() const

so that:

BOOST_STATIC_ASSERT((boost::tti::has_comp_member_function_begin<std::vector<int>::const_iterator

(std::vector<int>::*)(void) const>::value));

does indeed work.

It does seem as if putting the 'const' at the end is the correct
signature whereas putting it where you originally had it suggests a
const member function pointer and not a member function pointer to a
const member function.

>
> Have I done something silly? Testing const-member functions seems OK
> with BOOST_TTI_HAS_MEMBER_FUNCTION BTW.

All the more reason to use the mpl sequence form rather than the
composite form unless there is really a need for the composite form with
some sort of arcane calling convention or compiler-specific syntax.
That's just my opinion of course and I am glad to supply both forms.


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