Boost logo

Boost :

Subject: Re: [boost] decltype and incomplete types
From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2010-04-08 17:58:28


On Thu, Apr 8, 2010 at 4:52 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Daniel Walker wrote:
>>
>> True. I only meant to show that there are circumstance where
>> successful overload resolution may require a complete type. Here's
>> another example that doesn't use function arguments. One could imagine
>> a scenario such as
>>
>> template<class T>
>> typename boost::enable_if<
>>  boost::is_pod<T>, T
>>
>>>
>>> ::type foo();
>>>
>>
>> template<class T>
>> typename boost::disable_if<
>>  boost::is_pod<T>, int
>>
>>>
>>> ::type foo();
>>>
>>
>> Here the type of the expression foo<S>() cannot be determined if S is
>> incomplete.
>>
>
> Again this isn't *because* S is the return type.  It's
> because it's passed to a template that requires a
> complete type.

Yes, but the type of a call expression is also required to be a
complete type. Maybe this isn't a good example either, since, as you
point out, overload resolution can't even begin when S is incomplete
due to is_pod. But it seems to me the situations are comparable,
conceptually at least. But maybe things are changing. decltype allows
us to put call expressions in contexts that they could never appear in
before, so perhaps the type requirements for call expressions can be
loosened in some of these new contexts.

Daniel Walker


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