From e4f632e5ca62aae0a7e3fc2f299e5f855ecdba08 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 11 Jul 2004 03:09:35 +0000 Subject: [PATCH] function_template.hpp: Move definition of operator() out-of-line for any compiler that isn't VC++ 6.0 (Vladimir Prus) [SVN r23436] --- include/boost/function/function_template.hpp | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index cd4439b..f75078e 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -307,6 +307,9 @@ namespace boost { ~BOOST_FUNCTION_FUNCTION() { clear(); } +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + // MSVC 6.0 and prior require all definitions to be inline, but + // these definitions can become very costly. result_type operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) @@ -322,6 +325,9 @@ namespace boost { return result; #endif // BOOST_NO_VOID_RETURNS } +#else + result_type operator()(BOOST_FUNCTION_PARMS) const; +#endif // The distinction between when to use BOOST_FUNCTION_FUNCTION and // when to use self_type is obnoxious. MSVC cannot handle self_type as @@ -556,6 +562,32 @@ namespace boost { f1.swap(f2); } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + template + typename BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, + Allocator>::result_type + BOOST_FUNCTION_FUNCTION + ::operator()(BOOST_FUNCTION_PARMS) const + { + if (this->empty()) + boost::throw_exception(bad_function_call()); + + internal_result_type result = invoker(this->functor + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_ARGS); + +# ifndef BOOST_NO_VOID_RETURNS + return static_cast(result); +# else + return result; +# endif // BOOST_NO_VOID_RETURNS + } +#endif + // Poison comparisons between boost::function objects of the same type. template