Subject: Re: [boost] Formal Review Request: TypeErasure
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-06-26 15:18:58
On 06/26/2012 11:41 AM, Larry Evans wrote:
> The template parameters of the concept may involve placeholders.
> * Each template argument may be a cv and/or reference
> qualified placeholder type.
> * If a template argument is a function type, its arguments and
> return type may be cv/reference qualified placeholders.
> but, because of the 'may's it doesn't require a placeholder.
That's correct. The errors that you're
getting stem from a different cause. The
library doesn't actually require any placeholders,
although it isn't terribly useful without them.
> Now, obviously, the placeholder is the only way to retrieve the value
> of the data stored in the any, and you could reason that a placeholder
> is obviously needed; however, I think that needs to be explicitly
> stated so there's no confusion (I confess, I was actually confused by
> this and it took several trials before I finally concluded that a
> placeholder was required).
> The attached file, when compiled with:
> #define MODEL_DEFAULT_SELF
> compiles and runs OK.
That would be a bug. The code should
not compile with either setting.
> However, with:
> //#define MODEL_DEFAULT_SELF
> gcc4.8 fails to compile it and gives a very obscure error message
> ../../../boost/type_erasure/call.hpp:530:89: required from 'typename
> boost::type_erasure::detail::call_result<Op, void(U0&)>::type
> boost::type_erasure::call(const Op&, U0&) [with Op = concept<>; U0 =
> int; typename boost::type_erasure::detail::call_result<Op,
> void(U0&)>::type = void]'
> concept_ph.cpp:84:5: required from here
> ../../../boost/type_erasure/detail/get_signature.hpp:23:5: error:
> incomplete type 'void' used in nested name specifier
> BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested, &Concept::apply)
> which seems to support the position that some placeholder is required
> in the concept's template arguments, AFAICT.
For some reason, gcc tends to make errors with call
point to BOOST_TYPEOF.
Anyway, I can compile the following just fine with
int i = 0;
// i = 1
The problems with your code are:
a) call(concept<int>(), y)
- The library cannot deduce the the
binding because none of the arguments
is an any.
b) call(concept<_self>(), a_any)
- concept<_self> is not part of the requirements
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk