X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fimpl%2Fmembind.hh;h=5146e4c4e0680c5a61634871e467a1ba6cdc1b0a;hb=3863d46dd898b7bc35ea8c6ccd8563b18762a6b6;hp=a0c619d830f66c9d5cd5d2c8eca914f328a8b6fb;hpb=ac6a813d9d99f7add4e13aff7a4bcd314d5604a6;p=senf.git diff --git a/Utils/impl/membind.hh b/Utils/impl/membind.hh index a0c619d..5146e4c 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 +// Copyright (C) 2006 +// 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 @@ -34,25 +34,38 @@ boost::function membind(R (T::* fn)(),scOBTYPE ob) return boost::bind(fn,ob); } +template +boost::function membind(R (T::* fn)() const,scOBTYPE ob) +{ + return boost::bind(fn,ob); +} + // for BOOST_PP_ITERATION() in 2..9 do -#define BOOST_PP_ITERATION_PARAMS_1 (4, (2, 9, "Utils/impl/membind.hh", 1)) +#define BOOST_PP_ITERATION_PARAMS_1 (4, (2, 9, SENF_ABSOLUTE_INCLUDE_PATH(Utils/impl/membind.hh), 1)) #include BOOST_PP_ITERATE() #elif BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==1 // {{ #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) > -boost::function +boost::function membind(R (T::* fn)( scPARAMS(A) ), scOBTYPE ob) { return boost::bind(fn, ob, scPARAMS(_) ); } +template < typename R, typename T, scPARAMS(typename A) > +boost::function +membind(R (T::* fn)( scPARAMS(A) ) const, scOBTYPE ob) +{ + return boost::bind(fn, ob, scPARAMS(_) ); +} + #undef scPARAMS #undef scARG - + // } #endif // done @@ -60,4 +73,10 @@ membind(R (T::* fn)( scPARAMS(A) ), scOBTYPE ob) // Local Variables: // mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: