Re: [sigc] C++0x lambdas



2012-07-14 10:16, Chow Loong Jin skrev:
On 13/07/2012 22:53, Kjell Ahlstedt wrote:

I'm also interested in the amendment you mention that compiles with -std=c++98.
Are you willing to show it? It's not very attractive to include BOOST_TYPEOF in
libsigc++, but still I'm interested, to see if it's something that I should
consider for my bug report.
To be honest, I had actually lost that snippet of code, but it turns out it
wasn't too difficult to re-do based on the C++11 version:

//-------------------
namespace sigc
{
     template <typename Functor>
     struct functor_trait<Functor, false>
     {
         typedef BOOST_TYPEOF_TPL (sigc::mem_fun
                                   (boost::declval<Functor&> (),
                                    &Functor::operator())) _intermediate;


         typedef typename _intermediate::result_type result_type;
         typedef Functor functor_type;
     };
}
//-------------------

Thanks.
I haven't tested it (and will probably not do it) but it seems quite reasonable. I suppose it will also require some calls to BOOST_TYPEOF_REGISTER_TEMPLATE.

But I will not propose it for inclusion in libsigc++. The aim of my bug report https://bugzilla.gnome.org/show_bug.cgi?id=672555 is to reduce the amount of code in the non-deprecated part of libsigc++. This would require quite a lot of Boost code. Your template specialization with C++11 decltype is much better in that respect, although it does require a C++11 compatible compiler. That will be no problem in the future.

Kjell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]