Re: [Boost-bugs] [Boost C++ Libraries] #1396: wrong result_of invocation around transform_view

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1396: wrong result_of invocation around transform_view
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-11-29 02:49:25


#1396: wrong result_of invocation around transform_view
----------------------------------------------------+-----------------------
  Reporter: Shunsuke Sogame <pstade.mb_at_[hidden]> | Owner: djowel
      Type: Bugs | Status: new
 Milestone: Boost 1.35.0 | Component: fusion
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
----------------------------------------------------+-----------------------
Comment (by anonymous):

 IMO, you are wrong. It is correct. The example you have in the boost list
 thread certainly is ill formed. The example I have here is not.

 I've followed the thread (http://tinyurl.com/298abt) but what you missed
 is the template. The T in Fun(T) is generic and can accommodate references
 too. This(int) does not.

 If you want to avoid dangling references, you can write it as:
 {{{

 struct identity
 {
     template<class FunCall>
     struct result;

     template <class Fun, class T>
     struct result<Fun(T&)>
     {
         typedef T& type;
     };

     template <class Fun, class T>
     struct result<Fun(T const&)>
     {
         typedef T type;
     };

     template <class T>
     T& operator()(T& val) const
     {
         return val;
     }

     template <class T>
     T operator()(T const& val) const
     {
         return val;
     }
 };

 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1396#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:49:57 UTC