|
Boost : |
Subject: Re: [boost] is_range metafunction
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-10-05 19:54:29
Daniel Walker wrote:
> Is there any other option? I mean if t<x> is ill-formed, because the
> type x doesn't support some expression used in the template t, then is
> there some context where t could be instantiated with x without making
> the whole program ill-formed? I can't think of one.
SFINAE for expressions, available in C++0x (GCC 4.4 implements it,
albeit only with sizeof and not with decltype).
> If there were such a context, then you might be able associate t<x>'s
> ill-formation with some boolean constant, and you would have a way to
> implement tests based on concept checking templates - a sort of
> concept-based type introspection for C++03, which would be way cool.
That thing is mostly already doable in C++03.
See this, for example:
<http://neoscientists.org/~tschwinger/boostdev/concept_traits/libs/concept_traits/doc/>
> This brings up an interesting question regarding the proposed concept
> language extensions for C++0x: If a function in an overload set
> requires a concept that its argument doesn't model but some other
> function in the set accepts the argument, does overload resolution
> succeed?
Of course.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk