Re: [Boost-bugs] [Boost C++ Libraries] #4540: fold<Sequence>() instantiates result_of::fold<Sequence const>

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4540: fold<Sequence>() instantiates result_of::fold<Sequence const>
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-08-18 08:58:40


#4540: fold<Sequence>() instantiates result_of::fold<Sequence const>
--------------------------------------+-------------------------------------
  Reporter: anonymous | Owner: djowel
      Type: Bugs | Status: reopened
 Milestone: Boost 1.44.0 | Component: fusion
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------
Changes (by anonymous):

  * status: closed => reopened
  * resolution: wontfix =>

Comment:

 reopening this ticket for now, as I think it can be fixed, even though
 "component" might have to be changed:

 {{{

 BOOST_MPL_HAS_XXX_TRAIT_DEF(type)

 struct invalid;

 template<typename F,typename Args>
 struct result_of_impl{
     typedef typename boost::mpl::eval_if<
         has_type<typename F::template result<Args> >,
         typename F::template result<Args>,
         boost::mpl::identity<invalid>
>::type type;
 };

 }}}

 with this fix to result_of your code above yields these results:

 {{{

     A a;
     bub(a); //ok
     bub(A()); //error: use of undefined type "invalid"

 }}}

 do you see any problems with this?
 "invalid" could be further extended to give a meaningful error message,
 e.g. undefined_result_type<FArgs>

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4540#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC