Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-28 16:15:45


AMDG

David Abrahams wrote:
>> The result is that any constructs
>> involving templates that cannot be instantiated cannot safely appear
>> in the interfaces of non-metafunction class templates.
>>
>
> Actually I think they can if you wrap them appropriately:
>
> instead of
>
> foo<_1, _2>
>
> you write:
>
> do_not_instantiate(foo<_1,_2>)
>
> I don't think function types have associated namespaces, do they?
>

I wish it were that easy:

"If T is a function type, its associated namespaces and classes are
those associated with the function
parameter types and those associated with the return type."

>>>
>>>
>> And this is better than the possibility of obscure errors when
>> the compiler unexpectedly instantiates vector<foo(bar)>
>>
>
> It's "better" as long as you're not trying to do the kinds of things we
> do with MPL lambdas and related constructs like many of those that
> appear in Proto.
>

In proto, it happens to be safe currently because ADL does not look at the
template parameters of base classes, so there is nothing to trigger the
instantiation.
(Assuming that the standard library doesn't have non-type default parameters
or default parameters that trigger the instantiation of T...)

I wonder if there is any way to create a "Placeholderable" concept.

In Christ,
Steven Watanabe


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