Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: TypeErasure
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-06-26 14:41:58

On 05/22/12 15:34, Steven Watanabe wrote:
> I'd like to request a formal review of the
> TypeErasure library that I've posted about
> several times before here.
> The TypeErasure library is a generalization
> of boost::any and boost::function. It
> allows easy composition of arbitrary
> type erased operators.
> The library is available in the Boost Sandbox at
Shouldn't at least one of the template args to a concept definition be
a placeholder? The docs don't explicitly say this:



      Let's define a concept to allow push_back on a sequence. To do
      this, we create a class template with a template parameter for
      each argument, and a static member function called apply that
      calls push_back.

    Now the example following that paragraph does have a placeholder;
    however, the quoted paragraph doesn't state that it's needed.



      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.

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:


compiles and runs OK. However, with:


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.



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