Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Type Traits Extension by Frederic Bron
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-03-15 20:01:06


On 3/15/2011 6:48 PM, Vicente Botet wrote:
> Hi,
>
> The following two types are not used anywhere
> typedef typename ::boost::remove_cv::type rhs_nocv;
> typedef typename ::boost::remove_cv< typename ::boost::remove_reference<
> typename ::boost::remove_pointer::type>::type>::type rhs_noptr;
>
> Shouldn't them be removed?
>
> I have not see the utility of removing the reference
> typedef typename ::boost::remove_reference::type rhs_noref;
>
> Could you explain me why this is needed?
>
> I have a little problem with the has_operator_ prefix on the name of the
> traits. The traits is not checking the class parameter(s) has/have an
> operator, but that the application of the operator to this/these types is
> syntactically correct. E.g. has_operator_plus&lt;int, double&gt;::value
> neither int nor double have an operator+. applicable_operator_plus&lt;int,
> double&gt;::value or can_apply_operator_plus could be an option.
>
> If we wanted to define a trait to see if a class has a member function
> begin(), i.e. c.begin() is correct, we could name it has_begin.

In TTI it becomes boost::tti::has_member_function_begin using the simple
form of the macro expansion.

> But if we
> wanted to check if we can call begin(c) how we name the trait, has_begin?

I would think that 'has_function_begin' would distinguish it nicely.

>
> Note that in the standard all the traits prefixed by has_ applies to some
> property the type has. I recognize that this is not to important, but if
> someone could find a better name ... Forget this last comment if you find it
> is misplaced.

I think 'has_' is fine.


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