Boost logo

Boost :

Subject: Re: [boost] review request: addition to type_traits library ofhas_operator_xxx
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-11-17 15:48:08


Frédéric Bron wrote:
>
> > Those names are not consistent with
> > boost::has_new_operator. That is, you need to rename them
> > like the following for consistency:
> >
> > s/has_operator_\(.+\)/has_\1_operator/
> >
> > The result won't be perfect. For example,
> > "has_operator_divides" should be renamed "has_division_operator."
> >
> > Renaming "has_new_operator" seems more appropriate,
> > however. "has_operator_new" puts "operator" and "new" in the
> > right order as the query is for operator new, not the new operator.
> >
> > The same discussion applies to the other traits.
>
> The question of naming has already been discussed here :
> http://thread.gmane.org/gmane.comp.lib.boost.devel/194625

There wasn't much discussion. You asked about "has_operator_less_than" versus "has_less_than_operator" and I suggested that the former is more consistent with C++ syntax, but that deviates from boost::has_new_operator.

> At that time, we preferred has_operator_xxx to has_xxx_operator.

I still think its better.

> I agree that the whole type_traits library would need more consistency
> but this would break existing code.

We could add has_operator_new as an alias for has_new_operator (or vice versa) and then the new ones would all be has_operator_* and would be consistent with has_operator_new.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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