Boost logo

Boost :

Subject: Re: [boost] [type traits] is_literal_type ?
From: Robert Ramey (ramey_at_[hidden])
Date: 2013-03-02 14:07:05

John Maddock wrote:
>>> Can you give an example of how it's usage would be?
>> Sort an interesting question. I'm imagining something like:
>> template<class T>
>> int f(T const & t){
>> if(std::is_lteral_type<T>)
>> return t;
>> else
>> return g(t); // do some sort of conversion
>> }
>> in order to skip instantiation/invokation of g when it isn't
>> necessary in this example.
> That wouldn't work - just because a type is a literal type doesn't
> mean that it's convertible to int. In that particular case wouldn't
> is_convertible do?

lol - I knew this would happen. It's very difficult to make a quick
short answer to a question such as this. I'm sure I could spend
some time trying to craft a better example. The context in which
the question occurred to me is way too complicated to paste in

So I'll turn the tables. If there is no use case for it, why is it
in the standard? What use case did those who wrote the standard
have in mind? I'm all ears.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at