23 Nov
2014
23 Nov
'14
9:40 p.m.
On Sunday 23 November 2014 23:54:26 endight . wrote:
Is there something like `boost::is_lexical_convertible` (like `boost::is_convertible`)?
You mean a trait that tells if lexical_cast will work for your type? I don't think so. Your best bet is has_left_shift and has_right_shift, with the left operand type being the stream and the right one your type. But that doesn't tell that lexical_cast will actually succeed because the stream operators can be not reversible. In general there is no way to tell that the operators are reversible, so without some help from the user such a trait cannot be implemented.