X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fimpl%2Fmembind.hh;h=8c69a1c46707a2298248c8ecdf22412b4e91606f;hb=13d1ffe0c19d3085f1cf28f1a1c53d96572c0abe;hp=7dc1930ad83b818ea88fc7026fab97b844afa3a4;hpb=8d2d26f114d3df0a60c5c516fcf40671b1e55558;p=senf.git diff --git a/Utils/impl/membind.hh b/Utils/impl/membind.hh index 7dc1930..8c69a1c 100644 --- a/Utils/impl/membind.hh +++ b/Utils/impl/membind.hh @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,12 +27,23 @@ #include #include #include -#include "../../config.h" -template -boost::function membind(R (T::* fn)(),scOBTYPE ob) +template +boost::function membind(R (T1::* fn)(),T2 scOBTYPE ob) { - return boost::bind(fn,ob); + return boost::bind(fn,static_cast(ob)); +} + +template +boost::function membind(R (T1::* fn)() const, T2 const scOBTYPE ob) +{ + return boost::bind(fn,static_cast(ob)); +} + +template +boost::function membind(R (T1::* fn)() const, T2 scOBTYPE ob) +{ + return boost::bind(fn,static_cast(ob)); } // for BOOST_PP_ITERATION() in 2..9 do @@ -44,11 +55,25 @@ boost::function membind(R (T::* fn)(),scOBTYPE ob) #define scARG(z,n,d) BOOST_PP_CAT(d,n) #define scPARAMS(d) BOOST_PP_ENUM_SHIFTED(BOOST_PP_ITERATION(),scARG,d) -template < typename R, typename T, scPARAMS(typename A) > +template < typename R, typename T1, typename T2, scPARAMS(typename A) > +boost::function +membind(R (T1::* fn)( scPARAMS(A) ), T2 scOBTYPE ob) +{ + return boost::bind(fn, static_cast(ob), scPARAMS(_) ); +} + +template < typename R, typename T1, typename T2, scPARAMS(typename A) > +boost::function +membind(R (T1::* fn)( scPARAMS(A) ) const, T2 const scOBTYPE ob) +{ + return boost::bind(fn, static_cast(ob), scPARAMS(_) ); +} + +template < typename R, typename T1, typename T2, scPARAMS(typename A) > boost::function -membind(R (T::* fn)( scPARAMS(A) ), scOBTYPE ob) +membind(R (T1::* fn)( scPARAMS(A) ) const, T2 scOBTYPE ob) { - return boost::bind(fn, ob, scPARAMS(_) ); + return boost::bind(fn, static_cast(ob), scPARAMS(_) ); } #undef scPARAMS