Boost logo

Boost :

Subject: Re: [boost] [type_traits] adding is_less_comparable<T>, etc.
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-09-03 11:38:41

Frédéric Bron wrote:
> 2. there is no difference between using a factory function and using a
> static reference to a value of the type -> I prefer the static
> reference

This is compile time code, so there should be no runtime observable result, but I wonder if its possible that the references would trigger some compiler to produce symbols the factory functions would not. The references are definitely superior to instances, but I think the factory function approach is the accepted practice for this purpose.

> 3. there is no difference between using pass/fail and return char or
> char[2] but pass/fail is easier to read -> I keep it

As John Maddock pointed out, there are other types to use for such purposes in Type Traits and other libraries. It would be appropriate to use the Type Traits types here.

> So the following code has the following properties:
> * returns true if t<u is meaningful and returns a value
> convertible to bool
> * returns false if t<u is meaningless.
> * fails with compile time error if t<u is meaningful and returns void

I'd like to see something done to detect the void return, with a meaningful error message though. It is possible to extract the return type from a function pointer and check for that being the same as void, so it might be possible to form a pointer to the operator. You'd have to know whether the argument types are built-in types, in which case you can short-circuit the answer. If not, you'd have to determine whether the operator is a free function or a member in order to create the proper pointer type. Once you have that, you can extract the return type and compare it. Finally, you can use BOOST_STATIC_ASSERT to complain if the return type is void.

> Can I add your names in the copyright notice ? (Robert Stewart, Steven
> Watanabe, Roman Perepelitsa).

Yes, thank you.

Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP

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, gregod at, cpdaniel at, john at