commit c9fe13ddca1304303a493f8ea3ecc1def9cea9f4 Author: Beman Dawes Date: Fri Jul 7 16:04:40 2000 +0000 This commit was generated by cvs2svn to compensate for changes in r4, which included commits to RCS files with non-trunk default branches. [SVN r7621] diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3e84d7c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,96 @@ +* text=auto !eol svneol=native#text/plain +*.gitattributes text svneol=native#text/plain + +# Scriptish formats +*.bat text svneol=native#text/plain +*.bsh text svneol=native#text/x-beanshell +*.cgi text svneol=native#text/plain +*.cmd text svneol=native#text/plain +*.js text svneol=native#text/javascript +*.php text svneol=native#text/x-php +*.pl text svneol=native#text/x-perl +*.pm text svneol=native#text/x-perl +*.py text svneol=native#text/x-python +*.sh eol=lf svneol=LF#text/x-sh +configure eol=lf svneol=LF#text/x-sh + +# Image formats +*.bmp binary svneol=unset#image/bmp +*.gif binary svneol=unset#image/gif +*.ico binary svneol=unset#image/ico +*.jpeg binary svneol=unset#image/jpeg +*.jpg binary svneol=unset#image/jpeg +*.png binary svneol=unset#image/png +*.tif binary svneol=unset#image/tiff +*.tiff binary svneol=unset#image/tiff +*.svg text svneol=native#image/svg%2Bxml + +# Data formats +*.pdf binary svneol=unset#application/pdf +*.avi binary svneol=unset#video/avi +*.doc binary svneol=unset#application/msword +*.dsp text svneol=crlf#text/plain +*.dsw text svneol=crlf#text/plain +*.eps binary svneol=unset#application/postscript +*.gz binary svneol=unset#application/gzip +*.mov binary svneol=unset#video/quicktime +*.mp3 binary svneol=unset#audio/mpeg +*.ppt binary svneol=unset#application/vnd.ms-powerpoint +*.ps binary svneol=unset#application/postscript +*.psd binary svneol=unset#application/photoshop +*.rdf binary svneol=unset#text/rdf +*.rss text svneol=unset#text/xml +*.rtf binary svneol=unset#text/rtf +*.sln text svneol=native#text/plain +*.swf binary svneol=unset#application/x-shockwave-flash +*.tgz binary svneol=unset#application/gzip +*.vcproj text svneol=native#text/xml +*.vcxproj text svneol=native#text/xml +*.vsprops text svneol=native#text/xml +*.wav binary svneol=unset#audio/wav +*.xls binary svneol=unset#application/vnd.ms-excel +*.zip binary svneol=unset#application/zip + +# Text formats +.htaccess text svneol=native#text/plain +*.bbk text svneol=native#text/xml +*.cmake text svneol=native#text/plain +*.css text svneol=native#text/css +*.dtd text svneol=native#text/xml +*.htm text svneol=native#text/html +*.html text svneol=native#text/html +*.ini text svneol=native#text/plain +*.log text svneol=native#text/plain +*.mak text svneol=native#text/plain +*.qbk text svneol=native#text/plain +*.rst text svneol=native#text/plain +*.sql text svneol=native#text/x-sql +*.txt text svneol=native#text/plain +*.xhtml text svneol=native#text/xhtml%2Bxml +*.xml text svneol=native#text/xml +*.xsd text svneol=native#text/xml +*.xsl text svneol=native#text/xml +*.xslt text svneol=native#text/xml +*.xul text svneol=native#text/xul +*.yml text svneol=native#text/plain +boost-no-inspect text svneol=native#text/plain +CHANGES text svneol=native#text/plain +COPYING text svneol=native#text/plain +INSTALL text svneol=native#text/plain +Jamfile text svneol=native#text/plain +Jamroot text svneol=native#text/plain +Jamfile.v2 text svneol=native#text/plain +Jamrules text svneol=native#text/plain +Makefile* text svneol=native#text/plain +README text svneol=native#text/plain +TODO text svneol=native#text/plain + +# Code formats +*.c text svneol=native#text/plain +*.cpp text svneol=native#text/plain +*.h text svneol=native#text/plain +*.hpp text svneol=native#text/plain +*.ipp text svneol=native#text/plain +*.tpp text svneol=native#text/plain +*.jam text svneol=native#text/plain +*.java text svneol=native#text/plain diff --git a/function_test.cpp b/function_test.cpp new file mode 100644 index 0000000..8deaf58 --- /dev/null +++ b/function_test.cpp @@ -0,0 +1,257 @@ +// ------------------------------------------------------------------------------ +// Tests for the Boost functional.hpp header file +// +// Note that functional.hpp relies on partial specialisation to be +// effective. If your compiler lacks this feature, very few of the +// tests would compile, and so have been excluded from the test. +// ------------------------------------------------------------------------------ +// Copyright (c) 2000 +// Cadenza New Zealand Ltd +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without +// fee, provided that the above copyright notice appears in all copies +// and that both the copyright notice and this permission notice +// appear in supporting documentation. Cadenza New Zealand Ltd makes +// no representations about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. +// ------------------------------------------------------------------------------ +// $Id$ +// ------------------------------------------------------------------------------ +// $Log$ +// Revision 1.1.1.1 2000/07/07 16:04:18 beman +// 1.16.1 initial CVS checkin +// +// Revision 1.3 2000/06/26 09:44:01 mark +// Updated following feedback from Jens Maurer. +// +// Revision 1.2 2000/05/17 08:31:45 mark +// Added extra tests now that function traits work correctly. +// For compilers with no support for partial specialisation, +// excluded tests that won't work. +// +// Revision 1.1 2000/05/07 09:14:41 mark +// Initial revision +// ------------------------------------------------------------------------------ + +// To demonstrate what the boosted function object adapters do for +// you, try compiling with USE_STD defined. This will endeavour to +// use the standard function object adapters, but is likely to result +// in numerous errors due to the fact that you cannot have references +// to references. +#ifdef USE_STD +#include +#define boost std +#else +#include +#endif + +#include +#include +#include +#include +#include + +class Person +{ + public: + Person() {} + Person(const char *n) : name(n) {} + + const std::string &get_name() const { return name; } + void print(std::ostream &os) const { os << name << " "; } + void set_name(const std::string &n) { name = n; std::cout << name << " "; } + std::string clear_name() { std::string ret = name; name = ""; return ret; } + void do_something(int) const {} + + bool is_fred() const { return name == "Fred"; } + + private: + std::string name; +}; + +namespace +{ + bool is_equal(const std::string &s1, const std::string &s2) + { + return s1 == s2; + } + + bool is_betty(const std::string &s) + { + return s == "Betty"; + } + + void do_set_name(Person *p, const std::string &name) + { + p->set_name(name); + } + + void do_set_name_ref(Person &p, const std::string &name) + { + p.set_name(name); + } +} + +int main() +{ + std::vector v1; + v1.push_back("Fred"); + v1.push_back("Wilma"); + v1.push_back("Barney"); + v1.push_back("Betty"); + + const std::vector cv1(v1.begin(), v1.end()); + + std::vector v2; + v2.push_back("Fred"); + v2.push_back("Wilma"); + v2.push_back("Barney"); + v2.push_back("Betty"); + + Person person; + Person &r = person; + + Person fred("Fred"); + Person wilma("Wilma"); + Person barney("Barney"); + Person betty("Betty"); + std::vector v3; + v3.push_back(&fred); + v3.push_back(&wilma); + v3.push_back(&barney); + v3.push_back(&betty); + + const std::vector cv3(v3.begin(), v3.end()); + std::vector v3c(v3.begin(), v3.end()); + + std::ostream &os = std::cout; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // unary_traits, unary_negate + std::transform(v2.begin(), v2.end(), + std::ostream_iterator(std::cout, " "), + boost::not1(is_betty)); + + std::cout << '\n'; + std::transform(v1.begin(), v1.end(), + std::ostream_iterator(std::cout, " "), + boost::not1(boost::mem_fun_ref(&Person::is_fred))); + + // binary_traits, binary_negate + std::cout << '\n'; + std::transform(v2.begin(), v2.end(), + std::ostream_iterator(std::cout, " "), + boost::bind1st(boost::not2(is_equal), "Betty")); + + std::cout << '\n'; + std::transform(v2.begin(), v2.end(), + std::ostream_iterator(std::cout, " "), + boost::bind2nd(boost::not2(is_equal), "Betty")); + + // pointer_to_unary_function + std::cout << '\n'; + std::transform(v2.begin(), v2.end(), + std::ostream_iterator(std::cout, " "), + boost::not1(boost::ptr_fun(is_betty))); + + // binary_traits, bind1st, bind2nd + std::cout << '\n'; + std::transform(v2.begin(), v2.end(), + std::ostream_iterator(std::cout, " "), + boost::bind1st(is_equal, "Betty")); + + std::cout << '\n'; + std::transform(v2.begin(), v2.end(), + std::ostream_iterator(std::cout, " "), + boost::bind2nd(is_equal, "Betty")); + + // pointer_to_binary_function, bind1st + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(boost::ptr_fun(do_set_name), &person)); + + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(boost::ptr_fun(do_set_name_ref), person)); + + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(boost::ptr_fun(do_set_name_ref), r)); + + // binary_traits + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(do_set_name, &person)); + + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(do_set_name_ref, person)); + + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(do_set_name_ref, r)); +#endif + + // const_mem_fun_t + std::cout << '\n'; + std::transform(v3.begin(), v3.end(), + std::ostream_iterator(std::cout, " "), + boost::mem_fun(&Person::get_name)); + + std::cout << '\n'; + std::transform(cv3.begin(), cv3.end(), + std::ostream_iterator(std::cout, " "), + boost::mem_fun(&Person::get_name)); + + std::cout << '\n'; + std::transform(v3c.begin(), v3c.end(), + std::ostream_iterator(std::cout, " "), + boost::mem_fun(&Person::get_name)); + + // const_mem_fun_ref_t + std::cout << '\n'; + std::transform(v1.begin(), v1.end(), + std::ostream_iterator(std::cout, " "), + boost::mem_fun_ref(&Person::get_name)); + + std::cout << '\n'; + std::transform(cv1.begin(), cv1.end(), + std::ostream_iterator(std::cout, " "), + boost::mem_fun_ref(&Person::get_name)); + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // const_mem_fun1_t, bind2nd + std::cout << '\n'; + std::for_each(v3.begin(), v3.end(), boost::bind2nd(boost::mem_fun(&Person::print), std::cout)); + + std::cout << '\n'; + std::for_each(v3.begin(), v3.end(), boost::bind2nd(boost::mem_fun(&Person::print), os)); + + // const_mem_fun1_ref_t, bind2nd + std::cout << '\n'; + std::for_each(v1.begin(), v1.end(), boost::bind2nd(boost::mem_fun_ref(&Person::print), std::cout)); + + std::cout << '\n'; + std::for_each(v1.begin(), v1.end(), boost::bind2nd(boost::mem_fun_ref(&Person::print), os)); + + // mem_fun1_t, bind1st + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(boost::mem_fun(&Person::set_name), &person)); + + // mem_fun1_ref_t, bind1st + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(boost::mem_fun_ref(&Person::set_name), person)); + + std::cout << '\n'; + std::for_each(v2.begin(), v2.end(), boost::bind1st(boost::mem_fun_ref(&Person::set_name), r)); +#endif + + // mem_fun_t + std::cout << '\n'; + std::transform(v3.begin(), v3.end(), std::ostream_iterator(std::cout, " "), + boost::mem_fun(&Person::clear_name)); + + // mem_fun_ref_t + std::cout << '\n'; + std::transform(v1.begin(), v1.end(), std::ostream_iterator(std::cout, " "), + boost::mem_fun_ref(&Person::clear_name)); + + std::cout << '\n'; + return 0; +} diff --git a/include/boost/functional.hpp b/include/boost/functional.hpp new file mode 100644 index 0000000..7947c26 --- /dev/null +++ b/include/boost/functional.hpp @@ -0,0 +1,535 @@ +// ------------------------------------------------------------------------------ +// Boost functional.hpp header file +// ------------------------------------------------------------------------------ +// Copyright (c) 2000 +// Cadenza New Zealand Ltd +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without +// fee, provided that the above copyright notice appears in all copies +// and that both the copyright notice and this permission notice +// appear in supporting documentation. Cadenza New Zealand Ltd makes +// no representations about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. +// ------------------------------------------------------------------------------ +// $Id$ +// ------------------------------------------------------------------------------ +// $Log$ +// Revision 1.1.1.1 2000/07/07 16:03:47 beman +// 1.16.1 initial CVS checkin +// +// Revision 1.3 2000/06/26 09:44:54 mark +// Updated following feedback from Jens Maurer. +// +// Revision 1.2 2000/05/17 08:36:30 mark +// Fixed problems with function object traits thanks to ideas +// from John Maddock. +// +// Revision 1.1 2000/05/07 08:26:51 mark +// Initial revision +// ------------------------------------------------------------------------------ + +#ifndef BOOST_FUNCTIONAL_HPP +#define BOOST_FUNCTIONAL_HPP + +#include +#include +#include + +namespace boost +{ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // -------------------------------------------------------------------------- + // The following traits classes allow us to avoid the need for ptr_fun + // because the types of arguments and the result of a function can be + // deduced. + // + // In addition to the standard types defined in unary_function and + // binary_function, we add + // + // - function_type, the type of the function or function object itself. + // + // - param_type, the type that should be used for passing the function or + // function object as an argument. + // -------------------------------------------------------------------------- + namespace detail + { + template + struct unary_traits_imp; + + template + struct unary_traits_imp + { + typedef Operation function_type; + typedef const function_type & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::argument_type argument_type; + }; + + template + struct unary_traits_imp + { + typedef R (*function_type)(A); + typedef R (*param_type)(A); + typedef R result_type; + typedef A argument_type; + }; + + template + struct binary_traits_imp; + + template + struct binary_traits_imp + { + typedef Operation function_type; + typedef const function_type & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::first_argument_type first_argument_type; + typedef typename Operation::second_argument_type second_argument_type; + }; + + template + struct binary_traits_imp + { + typedef R (*function_type)(A1,A2); + typedef R (*param_type)(A1,A2); + typedef R result_type; + typedef A1 first_argument_type; + typedef A2 second_argument_type; + }; + } // namespace detail + + template + struct unary_traits + { + typedef typename detail::unary_traits_imp::function_type function_type; + typedef typename detail::unary_traits_imp::param_type param_type; + typedef typename detail::unary_traits_imp::result_type result_type; + typedef typename detail::unary_traits_imp::argument_type argument_type; + }; + + template + struct unary_traits + { + typedef R (*function_type)(A); + typedef R (*param_type)(A); + typedef R result_type; + typedef A argument_type; + }; + + template + struct binary_traits + { + typedef typename detail::binary_traits_imp::function_type function_type; + typedef typename detail::binary_traits_imp::param_type param_type; + typedef typename detail::binary_traits_imp::result_type result_type; + typedef typename detail::binary_traits_imp::first_argument_type first_argument_type; + typedef typename detail::binary_traits_imp::second_argument_type second_argument_type; + }; + + template + struct binary_traits + { + typedef R (*function_type)(A1,A2); + typedef R (*param_type)(A1,A2); + typedef R result_type; + typedef A1 first_argument_type; + typedef A2 second_argument_type; + }; +#else + // -------------------------------------------------------------------------- + // If we have no partial specialisation available, decay to a situation + // that is no worse than in the Standard, i.e., ptr_fun will be required. + // -------------------------------------------------------------------------- + + template + struct unary_traits + { + typedef Operation function_type; + typedef const Operation& param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::argument_type argument_type; + }; + + template + struct binary_traits + { + typedef Operation function_type; + typedef const Operation & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::first_argument_type first_argument_type; + typedef typename Operation::second_argument_type second_argument_type; + }; +#endif + + // -------------------------------------------------------------------------- + // unary_negate, not1 + // -------------------------------------------------------------------------- + template + class unary_negate + : public std::unary_function::argument_type,bool> + { + public: + explicit unary_negate(typename unary_traits::param_type x) + : + pred(x) + {} + bool operator()(typename call_traits::argument_type>::param_type x) const + { + return !pred(x); + } + private: + typename unary_traits::function_type pred; + }; + + template + unary_negate not1(const Predicate &pred) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return unary_negate((typename unary_traits::param_type)pred); + } + + // -------------------------------------------------------------------------- + // binary_negate, not2 + // -------------------------------------------------------------------------- + template + class binary_negate + : public std::binary_function::first_argument_type, + typename binary_traits::second_argument_type, + bool> + { + public: + explicit binary_negate(typename binary_traits::param_type x) + : + pred(x) + {} + bool operator()(typename call_traits::first_argument_type>::param_type x, + typename call_traits::second_argument_type>::param_type y) const + { + return !pred(x,y); + } + private: + typename binary_traits::function_type pred; + }; + + template + binary_negate not2(const Predicate &pred) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return binary_negate((typename binary_traits::param_type)pred); + } + + // -------------------------------------------------------------------------- + // binder1st, bind1st + // -------------------------------------------------------------------------- + template + class binder1st + : public std::unary_function::second_argument_type, + typename binary_traits::result_type> + { + public: + binder1st(typename binary_traits::param_type x, + typename call_traits::first_argument_type>::param_type y) + : + op(x), value(y) + {} + + typename binary_traits::result_type + operator()(typename call_traits::second_argument_type>::param_type x) const + { + return op(value, x); + } + + protected: + typename binary_traits::function_type op; + typename binary_traits::first_argument_type value; + }; + + template + inline binder1st bind1st(const Operation &op, + typename call_traits< + typename binary_traits::first_argument_type + >::param_type x) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return binder1st((typename binary_traits::param_type)op, x); + } + + // -------------------------------------------------------------------------- + // binder2nd, bind2nd + // -------------------------------------------------------------------------- + template + class binder2nd + : public std::unary_function::first_argument_type, + typename binary_traits::result_type> + { + public: + binder2nd(typename binary_traits::param_type x, + typename call_traits::second_argument_type>::param_type y) + : + op(x), value(y) + {} + + typename binary_traits::result_type + operator()(typename call_traits::first_argument_type>::param_type x) const + { + return op(x, value); + } + + protected: + typename binary_traits::function_type op; + typename binary_traits::second_argument_type value; + }; + + template + inline binder2nd bind2nd(const Operation &op, + typename call_traits< + typename binary_traits::second_argument_type + >::param_type x) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return binder2nd((typename binary_traits::param_type)op, x); + } + + // -------------------------------------------------------------------------- + // mem_fun, etc + // -------------------------------------------------------------------------- + template + class mem_fun_t : public std::unary_function + { + public: + explicit mem_fun_t(S (T::*p)()) + : + ptr(p) + {} + S operator()(T* p) const + { + return (p->*ptr)(); + } + private: + S (T::*ptr)(); + }; + + template + class mem_fun1_t : public std::binary_function + { + public: + explicit mem_fun1_t(S (T::*p)(A)) + : + ptr(p) + {} + S operator()(T* p, typename call_traits::param_type x) const + { + return (p->*ptr)(x); + } + private: + S (T::*ptr)(A); + }; + + template + class const_mem_fun_t : public std::unary_function + { + public: + explicit const_mem_fun_t(S (T::*p)() const) + : + ptr(p) + {} + S operator()(const T* p) const + { + return (p->*ptr)(); + } + private: + S (T::*ptr)() const; + }; + + template + class const_mem_fun1_t : public std::binary_function + { + public: + explicit const_mem_fun1_t(S (T::*p)(A) const) + : + ptr(p) + {} + S operator()(const T* p, typename call_traits::param_type x) const + { + return (p->*ptr)(x); + } + private: + S (T::*ptr)(A) const; + }; + + template + inline mem_fun_t mem_fun(S (T::*f)()) + { + return mem_fun_t(f); + } + + template + inline mem_fun1_t mem_fun(S (T::*f)(A)) + { + return mem_fun1_t(f); + } + + template + inline const_mem_fun_t mem_fun(S (T::*f)() const) + { + return const_mem_fun_t(f); + } + + template + inline const_mem_fun1_t mem_fun(S (T::*f)(A) const) + { + return const_mem_fun1_t(f); + } + + // -------------------------------------------------------------------------- + // mem_fun_ref, etc + // -------------------------------------------------------------------------- + template + class mem_fun_ref_t : public std::unary_function + { + public: + explicit mem_fun_ref_t(S (T::*p)()) + : + ptr(p) + {} + S operator()(T& p) const + { + return (p.*ptr)(); + } + private: + S (T::*ptr)(); + }; + + template + class mem_fun1_ref_t : public std::binary_function + { + public: + explicit mem_fun1_ref_t(S (T::*p)(A)) + : + ptr(p) + {} + S operator()(T& p, typename call_traits::param_type x) const + { + return (p.*ptr)(x); + } + private: + S (T::*ptr)(A); + }; + + template + class const_mem_fun_ref_t : public std::unary_function + { + public: + explicit const_mem_fun_ref_t(S (T::*p)() const) + : + ptr(p) + {} + + S operator()(const T &p) const + { + return (p.*ptr)(); + } + private: + S (T::*ptr)() const; + }; + + template + class const_mem_fun1_ref_t : public std::binary_function + { + public: + explicit const_mem_fun1_ref_t(S (T::*p)(A) const) + : + ptr(p) + {} + + S operator()(const T& p, typename call_traits::param_type x) const + { + return (p.*ptr)(x); + } + private: + S (T::*ptr)(A) const; + }; + + template + inline mem_fun_ref_t mem_fun_ref(S (T::*f)()) + { + return mem_fun_ref_t(f); + } + + template + inline mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)) + { + return mem_fun1_ref_t(f); + } + + template + inline const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const) + { + return const_mem_fun_ref_t(f); + } + + template + inline const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const) + { + return const_mem_fun1_ref_t(f); + } + + // -------------------------------------------------------------------------- + // ptr_fun + // -------------------------------------------------------------------------- + template + class pointer_to_unary_function : public std::unary_function + { + public: + explicit pointer_to_unary_function(Result (*f)(Arg)) + : + func(f) + {} + + Result operator()(typename call_traits::param_type x) const + { + return func(x); + } + + private: + Result (*func)(Arg); + }; + + template + inline pointer_to_unary_function ptr_fun(Result (*f)(Arg)) + { + return pointer_to_unary_function(f); + } + + template + class pointer_to_binary_function : public std::binary_function + { + public: + explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)) + : + func(f) + {} + + Result operator()(typename call_traits::param_type x, typename call_traits::param_type y) const + { + return func(x,y); + } + + private: + Result (*func)(Arg1, Arg2); + }; + + template + inline pointer_to_binary_function ptr_fun(Result (*f)(Arg1, Arg2)) + { + return pointer_to_binary_function(f); + } +} // namespace boost + +#endif