Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77410 - in sandbox/overload/trunk: . boost boost/overload boost/overload/detail libs/overload/docs libs/overload/docs/html libs/overload/docs/html/boost_overload libs/overload/docs/qbk libs/overload/examples libs/overload/tests libs/overload/tests/test libs/overload/tests/test/detail
From: mrcekets_at_[hidden]
Date: 2012-03-19 15:48:22


Author: mcecchetti
Date: 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
New Revision: 77410
URL: http://svn.boost.org/trac/boost/changeset/77410

Log:
Boost.Overload release 0.4.0

All changes are reported in the README_FIRST.txt file
Added:
   sandbox/overload/trunk/Jamroot.jam (contents, props changed)
   sandbox/overload/trunk/boost/overload/config.hpp (contents, props changed)
   sandbox/overload/trunk/boost/overload/detail/get_signature.hpp (contents, props changed)
   sandbox/overload/trunk/boost/overload/detail/lambda_result_type_support.hpp (contents, props changed)
   sandbox/overload/trunk/boost/overload/detail/result_type.hpp (contents, props changed)
   sandbox/overload/trunk/boost/overload/make_overload.hpp (contents, props changed)
   sandbox/overload/trunk/boost/overload/make_overload_impl.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/acknowledgements.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/advanced_features.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/design_and_definitions.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/getting_started.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/references.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/tutorial.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/boost_overload/use_case.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/docutils.css (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/index.html (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/minimal.css (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/reference.css (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/html/standalone_HTML.manifest (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/
   sandbox/overload/trunk/libs/overload/docs/qbk/advanced_features.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/design_and_definitions.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/getting_started.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/overload.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/references.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/tutorial.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/docs/qbk/use_cases.qbk (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/Jamfile.jam (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/basic_usage.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/compatible_signature.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/helper_methods.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/index_syntax.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/lambda_result_type_support.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/make_overload.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/overview.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/result_of_support.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/set_for_each_shared_signature.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/signature_syntax_1.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/signature_syntax_2.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/signature_syntax_3.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/statefull_polymorphic_function_object.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/type_traits.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/use_case_variant_visitor.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/using_boost_function.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/using_function_objects.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/examples/using_member_functions.cpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/Jamfile.jam (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/as_functor.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/assignment.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/bind_and_lambda.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/compatible_signatures.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/contains.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/detail/
   sandbox/overload/trunk/libs/overload/tests/test/detail/change_result_type.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/function_object_with_state.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/get_signature.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/lambda_result_type_support.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/make_overload.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/metafunctions.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/result.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/set_target.hpp (contents, props changed)
   sandbox/overload/trunk/libs/overload/tests/test/test_target.hpp (contents, props changed)
Removed:
   sandbox/overload/trunk/libs/overload/docs/overload.qbk
   sandbox/overload/trunk/libs/overload/docs/tutorial.qbk
   sandbox/overload/trunk/libs/overload/examples/example_1.cpp
   sandbox/overload/trunk/libs/overload/examples/example_2.cpp
   sandbox/overload/trunk/libs/overload/examples/example_3.cpp
   sandbox/overload/trunk/libs/overload/examples/example_4.cpp
   sandbox/overload/trunk/libs/overload/examples/example_5.cpp
   sandbox/overload/trunk/libs/overload/examples/example_6.cpp
   sandbox/overload/trunk/libs/overload/examples/example_7a.cpp
   sandbox/overload/trunk/libs/overload/examples/example_7b.cpp
   sandbox/overload/trunk/libs/overload/examples/example_8a.cpp
   sandbox/overload/trunk/libs/overload/examples/example_8b.cpp
   sandbox/overload/trunk/libs/overload/tests/Jamfile.v2
Properties modified:
   sandbox/overload/trunk/ (props changed)
   sandbox/overload/trunk/libs/overload/docs/ (props changed)
   sandbox/overload/trunk/libs/overload/examples/ (props changed)
   sandbox/overload/trunk/libs/overload/tests/ (props changed)
Text files modified:
   sandbox/overload/trunk/boost/overload.hpp | 8
   sandbox/overload/trunk/boost/overload/detail/final_overload_base.hpp | 7
   sandbox/overload/trunk/boost/overload/detail/function_trait.hpp | 36 +-
   sandbox/overload/trunk/boost/overload/detail/functor_has_signature.hpp | 65 ++-
   sandbox/overload/trunk/boost/overload/detail/get_function_tag.hpp | 15
   sandbox/overload/trunk/boost/overload/detail/macro_def.hpp | 146 +++++--
   sandbox/overload/trunk/boost/overload/detail/macro_undef.hpp | 31 +
   sandbox/overload/trunk/boost/overload/detail/member_function_form.hpp | 18
   sandbox/overload/trunk/boost/overload/detail/member_function_trait.hpp | 14
   sandbox/overload/trunk/boost/overload/detail/overload_base.hpp | 29 +
   sandbox/overload/trunk/boost/overload/detail/trait_by_functor.hpp | 37 +
   sandbox/overload/trunk/boost/overload/detail/trait_by_index.hpp | 12
   sandbox/overload/trunk/boost/overload/detail/trait_by_signature.hpp | 12
   sandbox/overload/trunk/boost/overload/overload_impl.hpp | 705 +++++++++++++++++++++++++++++++++++----
   sandbox/overload/trunk/libs/overload/docs/Jamfile.v2 | 63 +++
   sandbox/overload/trunk/libs/overload/docs/README_FIRST.txt | 84 +++
   sandbox/overload/trunk/libs/overload/docs/html/boostbook.css | 268 +++++++++-----
   sandbox/overload/trunk/libs/overload/tests/test.cpp | 38 +
   sandbox/overload/trunk/libs/overload/tests/test/free_and_member_functions.hpp | 59 +++
   sandbox/overload/trunk/libs/overload/tests/test/functors.hpp | 64 +-
   sandbox/overload/trunk/libs/overload/tests/test/idx_and_sig_methods.hpp | 103 +++-
   sandbox/overload/trunk/libs/overload/tests/test/signature_deduction.hpp | 56 +-
   sandbox/overload/trunk/libs/overload/tests/test/signature_with_ptr_ref.hpp | 37 +
   sandbox/overload/trunk/libs/overload/tests/test/trait_by_functor.hpp | 23 +
   sandbox/overload/trunk/libs/overload/tests/test/trait_by_index.hpp | 2
   sandbox/overload/trunk/libs/overload/tests/test/trait_by_signature.hpp | 4
   26 files changed, 1457 insertions(+), 479 deletions(-)

Added: sandbox/overload/trunk/Jamroot.jam
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/Jamroot.jam 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,16 @@
+# Copyright 2012 (c) Marco Cecchetti
+# Released under the Boost Software License Version 1.0
+# See http://boost.org/LICENSE_1_0.txt for full license text.
+
+
+
+if ! $(BOOST_ROOT)
+{
+ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
+}
+
+project overload/tests
+ : requirements
+ <include>.
+ <include>$(BOOST_ROOT)
+ ;

Modified: sandbox/overload/trunk/boost/overload.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload.hpp (original)
+++ sandbox/overload/trunk/boost/overload.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,11 +10,7 @@
 #define _BOOST_OVERLOAD_HPP_
 
 
-#ifndef BOOST_OVERLOAD_LIMIT
- #define BOOST_OVERLOAD_LIMIT 10
-#endif
-
-#define BOOST_OVERLOAD_MAX_NUM_ARGS 10
+#include "overload/config.hpp"
 
 //#define BOOST_MSVC 1310 // for test only
 

Added: sandbox/overload/trunk/boost/overload/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/boost/overload/config.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,24 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_OVERLOAD_CONFIG_HPP_
+#define _BOOST_OVERLOAD_CONFIG_HPP_
+
+
+#ifndef BOOST_OVERLOAD_LIMIT
+ #define BOOST_OVERLOAD_LIMIT 10
+#endif
+
+// for enabling support of boost::lambda define the following macro
+// #define BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT
+
+#ifndef BOOST_OVERLOAD_MAX_NUM_ARGS
+ #define BOOST_OVERLOAD_MAX_NUM_ARGS 10
+#endif
+
+#endif // _BOOST_OVERLOAD_CONFIG_HPP_

Modified: sandbox/overload/trunk/boost/overload/detail/final_overload_base.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/final_overload_base.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/final_overload_base.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,6 +12,7 @@
 //#include <limits>
 #include <boost/function.hpp>
 
+
 namespace boost{ namespace overloads{ namespace detail{
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -21,9 +22,9 @@
 
 struct final_overload_base
 {
- static const unsigned int index = UINT_MAX;
+ BOOST_STATIC_CONSTANT( unsigned int, index = UINT_MAX );
     typedef final_overload_base base_type;
- typedef boost::function<no_signature> function_type;
+ typedef BOOST_OVERLOAD_WRAPPED_FUNC<no_signature> function_type;
     typedef no_signature signature_type;
     struct final;
     void operator()(final*) const {}

Modified: sandbox/overload/trunk/boost/overload/detail/function_trait.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/function_trait.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/function_trait.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,13 +22,13 @@
 ///////////////////////////////////////////////////////////////////////////////
 // helper macros
  
-#define OVL_ARG_TYPE(z, n, type) \
+#define BOOST_OVERLOAD_ARG_TYPE(z, n, type) \
 typedef type BOOST_PP_CAT(arg, BOOST_PP_CAT(n, _type));
-// end macro OVL_ARG_TYPE
+// end macro BOOST_OVERLOAD_ARG_TYPE
 
-#define OVL_IS_SIG_ARITY_ZERO(z, n, sig) \
+#define BOOST_OVERLOAD_IS_SIG_ARITY_ZERO(z, n, sig) \
 ( func_trait<BOOST_PP_CAT(sig,n)>::arity == 0 ) ||
-// end macro OVL_IS_SIG_ARITY_ZERO
+// end macro BOOST_OVERLOAD_IS_SIG_ARITY_ZERO
 
 
 namespace boost{ namespace overloads{ namespace detail{
@@ -55,32 +55,32 @@
 // compile issues
 
 template< typename Signature >
-struct func_trait : public boost::function_traits<Signature>
+struct func_trait : public ::boost::function_traits<Signature>
 {
 };
 
 template<>
 struct func_trait< no_signature >
 {
- static const unsigned int arity = UINT_MAX;
+ BOOST_STATIC_CONSTANT( unsigned int, arity = UINT_MAX );
         typedef no_type result_type;
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, OVL_ARG_TYPE, no_type);
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_ARG_TYPE, no_type)
 };
 
 template<unsigned int N>
 struct func_trait< dummy_signature<N> >
 {
- static const unsigned int arity = UINT_MAX;
+ BOOST_STATIC_CONSTANT( unsigned int, arity = UINT_MAX );
     typedef dummy_type<N> result_type;
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, OVL_ARG_TYPE, dummy_type<N>);
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_ARG_TYPE, dummy_type<N>)
 };
 
 template<typename error_type>
 struct func_trait< error<error_type> >
 {
- static const unsigned int arity = UINT_MAX;
+ BOOST_STATIC_CONSTANT( unsigned int, arity = UINT_MAX );
         typedef error_type result_type;
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, OVL_ARG_TYPE, error_type);
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_ARG_TYPE, error_type)
 };
 
 
@@ -104,10 +104,10 @@
 struct zero_arity_signature
 {
   private:
- static const bool sig0_no_arg = ( func_trait<Sig0>::arity == 0 );
- static const bool sig0_no_other_no_arg
+ BOOST_STATIC_CONSTANT( bool, sig0_no_arg = ( func_trait<Sig0>::arity == 0 ) );
+ BOOST_STATIC_CONSTANT( bool, sig0_no_other_no_arg
                 = !( BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_LIMIT,
- OVL_IS_SIG_ARITY_ZERO, Sig) false );
+ BOOST_OVERLOAD_IS_SIG_ARITY_ZERO, Sig) false ) );
   public:
         typedef
                 typename if_c<sig0_no_arg,
@@ -137,7 +137,7 @@
 struct real_or_dummy_signature
 {
   private:
- static const bool same_arity = ( func_trait<S>::arity == arity );
+ BOOST_STATIC_CONSTANT( bool, same_arity = ( func_trait<S>::arity == arity ) );
   public:
         typedef
                 typename if_c< same_arity, S, dummy_signature<N> >::type
@@ -147,8 +147,8 @@
 
 } } } // end namespaces
 
-#undef OVL_IS_SIG_ARITY_ZERO
-#undef OVL_ARG_TYPE
+#undef BOOST_OVERLOAD_IS_SIG_ARITY_ZERO
+#undef BOOST_OVERLOAD_ARG_TYPE
 
 #endif // _FUNCTION_TRAIT_HPP_
 

Modified: sandbox/overload/trunk/boost/overload/detail/functor_has_signature.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/functor_has_signature.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/functor_has_signature.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -33,13 +33,13 @@
     template<typename T> static char check(helper<&T::operator()>* );
     template<typename T> static char (& check(...))[2];
   public:
- static const bool value = ( sizeof(check<FunctionObj>(0)) == sizeof(char) );
+ BOOST_STATIC_CONSTANT( bool, value = ( sizeof(check<FunctionObj>(0)) == sizeof(char) ) );
 };
 
 template<typename FunctionObj>
 struct func_obj_has_signature<FunctionObj, no_signature, member_func_non_const_tag>
 {
- static const bool value = false;
+ BOOST_STATIC_CONSTANT( bool, value = false );
 };
 
 struct member_func_const_tag {}; // for member functions of kind "R f(..) const"
@@ -54,13 +54,13 @@
     template<typename T> static char check(helper<&T::operator()>* );
     template<typename T> static char (& check(...))[2];
   public:
- static const bool value = ( sizeof(check<FunctionObj>(0)) == sizeof(char) );
+ BOOST_STATIC_CONSTANT( bool, value = ( sizeof(check<FunctionObj>(0)) == sizeof(char) ) );
 };
 
 template<typename FunctionObj>
 struct func_obj_has_signature<FunctionObj, no_signature, member_func_const_tag>
 {
- static const bool value = false;
+ BOOST_STATIC_CONSTANT( bool, value = false );
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -71,7 +71,10 @@
           typename function_tag
                 = typename get_function_tag<Functor>::type
>
-struct functor_has_signature{ static const bool value = false; };
+struct functor_has_signature
+{
+// BOOST_STATIC_CONSTANT( bool, value = false );
+};
 
 template< typename FunctionPtr, typename Sig>
 struct functor_has_signature<FunctionPtr, Sig, function_ptr_tag>
@@ -79,7 +82,7 @@
     private:
       typedef typename remove_pointer<FunctionPtr>::type func_ptr_t;
     public:
- static const bool value = boost::is_same<func_ptr_t, Sig>::value;
+ BOOST_STATIC_CONSTANT( bool, value = (boost::is_same<func_ptr_t, Sig>::value) );
 };
 
 template< typename MemberPtr, typename Sig>
@@ -92,36 +95,60 @@
     typedef
         typename memb_func_trait<MemberPtr>::const_binded_type
         const_binded_type;
- static const bool const_qualified
- = memb_func_trait<MemberPtr>::const_qualified;
+ BOOST_STATIC_CONSTANT( bool, const_qualified
+ = (memb_func_trait<MemberPtr>::const_qualified) );
   public:
- static const bool value
- = boost::is_same<binded_type, Sig>::value
- || (boost::is_same<const_binded_type, Sig>::value && const_qualified);
+ BOOST_STATIC_CONSTANT( bool, value
+ = (boost::is_same<binded_type, Sig>::value
+ || (boost::is_same<const_binded_type, Sig>::value && const_qualified)) );
 };
 
 template< typename FunctionObj, typename Sig>
 struct functor_has_signature<FunctionObj, Sig, function_obj_tag>
 {
- static const bool value
- = func_obj_has_signature<FunctionObj, Sig>::value
- || func_obj_has_signature<FunctionObj, Sig, member_func_const_tag>::value;
+ BOOST_STATIC_CONSTANT( bool, value
+ = (func_obj_has_signature<FunctionObj, Sig>::value
+ || func_obj_has_signature<FunctionObj, Sig, member_func_const_tag>::value) );
 };
 
 template< typename FunctionObj, typename Sig>
 struct functor_has_signature<boost::reference_wrapper<FunctionObj>, Sig, function_obj_ref_tag>
 {
- static const bool value
- = func_obj_has_signature<FunctionObj, Sig>::value
- || func_obj_has_signature<FunctionObj, Sig, member_func_const_tag>::value;
+ BOOST_STATIC_CONSTANT( bool, value
+ = (func_obj_has_signature<FunctionObj, Sig>::value
+ || func_obj_has_signature<FunctionObj, Sig, member_func_const_tag>::value) );
 };
 
 template< typename FuncSig, typename Sig>
 struct functor_has_signature< boost::function<FuncSig>, Sig, function_obj_tag >
 {
- static const bool value = boost::is_same<FuncSig, Sig>::value;
+ BOOST_STATIC_CONSTANT( bool, value = (boost::is_same<FuncSig, Sig>::value) );
 };
 
+///////////////////////////////////////////////////////////////////////////////
+// test if a given functor is a pointer to a free or member function and its
+// signature matches exactly the Signature template argument;
+// in case Functor is not a pointer to a free or member function no functor
+// signature match is performed (so avoiding a compile time error in case
+// Functor is not really a functor)
+
+template<
+ typename Functor,
+ typename Signature,
+ bool IS_PTR_OR_MEMB_PTR = is_ptr_or_memb_ptr<Functor>::value
+>
+struct is_ptr_or_memb_ptr_and_has_matching_signature
+{
+ BOOST_STATIC_CONSTANT( bool, value = false );
+};
+
+template<typename Functor, typename Signature>
+struct is_ptr_or_memb_ptr_and_has_matching_signature<Functor, Signature, true>
+{
+ BOOST_STATIC_CONSTANT( bool, value = (functor_has_signature<Functor, Signature>::value) );
+};
+
+
 } } } // end namespaces
 
 #endif // _BOOST_OVERLOAD_DETAIL_FUNCTOR_HAS_SIGNATURE_HPP_

Modified: sandbox/overload/trunk/boost/overload/detail/get_function_tag.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/get_function_tag.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/get_function_tag.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,6 +12,7 @@
 
 #include <boost/type_traits/is_pointer.hpp>
 #include <boost/type_traits/is_member_pointer.hpp>
+#include <boost/type_traits/is_function.hpp>
 #include <boost/ref.hpp>
 
 #include "if_metafunction.hpp"
@@ -27,6 +28,7 @@
 struct function_obj_tag {};
 struct member_ptr_tag {};
 struct function_obj_ref_tag {};
+struct function_signature_tag {};
 
 template<typename F>
 class get_function_tag
@@ -42,18 +44,21 @@
     typedef typename if_c<(boost::is_reference_wrapper<F>::value),
                            function_obj_ref_tag,
                            ptr_or_obj_or_mem_tag>::type or_ref_tag;
+ typedef typename if_c<(boost::is_function<F>::value),
+ function_signature_tag,
+ or_ref_tag>::type or_sig_tag;
 
   public:
- typedef or_ref_tag type;
+ typedef or_sig_tag type;
 };
 
 
 template<typename F>
 struct is_ptr_or_memb_ptr
 {
- static const bool value
- = boost::is_pointer<F>::value
- || boost::is_member_pointer<F>::value;
+ BOOST_STATIC_CONSTANT( bool, value
+ = (boost::is_pointer<F>::value
+ || boost::is_member_pointer<F>::value) );
 };
 
 } } } // end namespaces

Added: sandbox/overload/trunk/boost/overload/detail/get_signature.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/boost/overload/detail/get_signature.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,76 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_OVERLOAD_GET_SIGNATURE_HPP_
+#define _BOOST_OVERLOAD_GET_SIGNATURE_HPP_
+
+
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include "member_function_trait.hpp"
+#include "get_function_tag.hpp"
+
+
+namespace boost{ namespace overloads{ namespace detail{
+
+
+template< typename Functor,
+ typename function_tag
+ = typename get_function_tag<Functor>::type
+>
+struct get_signature
+{
+};
+
+template< typename FunctionPtr>
+struct get_signature<FunctionPtr, function_ptr_tag>
+{
+ typedef typename remove_pointer<FunctionPtr>::type type;
+};
+
+template< typename MemberPtr>
+struct get_signature<MemberPtr, member_ptr_tag>
+{
+ typedef
+ typename memb_func_trait<MemberPtr>::binded_type
+ binded_type;
+ typedef
+ typename memb_func_trait<MemberPtr>::const_binded_type
+ const_binded_type;
+ BOOST_STATIC_CONSTANT( bool, const_qualified
+ = (memb_func_trait<MemberPtr>::const_qualified) );
+
+ typedef typename if_c<const_qualified, const_binded_type, binded_type>::type
+ type;
+};
+
+template< typename FunctionObj >
+struct get_signature<FunctionObj, function_obj_tag>
+{
+ typedef BOOST_TYPEOF_TPL(&FunctionObj::operator()) call_op_ptr;
+ typedef typename memb_func_trait<call_op_ptr>::sig_type type;
+};
+
+template< typename FunctionObj >
+struct get_signature<boost::reference_wrapper<FunctionObj>, function_obj_ref_tag>
+{
+ typedef typename get_signature<FunctionObj>::type type;
+};
+
+template< typename Signature >
+struct get_signature<boost::function<Signature>, function_obj_tag>
+{
+ typedef Signature type;
+};
+
+
+} } } // end namespaces
+
+
+#endif // _BOOST_OVERLOAD_GET_SIGNATURE_HPP_

Added: sandbox/overload/trunk/boost/overload/detail/lambda_result_type_support.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/boost/overload/detail/lambda_result_type_support.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,50 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_OVERLOAD_LAMBDA_RESULT_TYPE_SUPPORT_HPP_
+#define _BOOST_OVERLOAD_LAMBDA_RESULT_TYPE_SUPPORT_HPP_
+
+#include <boost/tuple/tuple.hpp>
+#include "result_type.hpp"
+
+
+#define BOOST_OVERLOAD_KET(z, n, text) >
+// end macro BOOST_OVERLOAD_KET
+
+#define BOOST_OVERLOAD_SIG(z, n, unused) \
+template< typename F BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A) > \
+struct sig< boost::tuples::cons<F BOOST_PP_ENUM_TRAILING_PARAMS(n, boost::tuples::cons<A), boost::tuples::null_type> BOOST_PP_REPEAT(n, BOOST_OVERLOAD_KET, unused) > \
+ : public result<F ( BOOST_PP_ENUM_PARAMS(n, A) )> \
+{ \
+};
+// end macro BOOST_OVERLOAD_SIG
+
+namespace boost{ namespace overloads{ namespace detail{
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunction: sig<Args>
+// requires: Args is a tuple< F, A0, A1, ..., AN> where F is an instantiation
+// of the boost::overload class template
+// returns: the result type of the call signature supported by F that
+// owns the same argument list as Args or undefined if there
+// is no supported call signature with the same argument list
+// provides: support for Boost.Lambda result type deduction
+
+template< typename Args>
+struct sig
+{};
+
+
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_OVERLOAD_MAX_NUM_ARGS), BOOST_OVERLOAD_SIG, unused)
+
+} } } // end namespaces
+
+#undef BOOST_OVERLOAD_SIG
+
+
+#endif // _BOOST_OVERLOAD_LAMBDA_RESULT_TYPE_SUPPORT_HPP_

Modified: sandbox/overload/trunk/boost/overload/detail/macro_def.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/macro_def.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/macro_def.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -9,43 +9,93 @@
 #ifndef _BOOST_OVERLOAD_DETAIL_MACRO_DEF_HPP_
 #define _BOOST_OVERLOAD_DETAIL_MACRO_DEF_HPP_
 
-
-#include <boost/preprocessor/repetition.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
 #include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/repetition.hpp>
 #include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/control/if.hpp>
 
+#define BOOST_OVERLOAD_WRAPPED_FUNC boost::function
 
-#define OVL_DEFAULT_TEMPL_ARG(z, n, unused) \
-detail::no_signature
-// end macro OVL_DEFAULT_TEMPL_ARG
-
-#define OVL_TEMPL_PARAMS(z, n, T) \
-typename BOOST_PP_CAT(T, n) = OVL_DEFAULT_TEMPL_ARG(z, n, unused)
-// end macro OVL_TEMPL_PARAMS
-
-#define OVL_SET_IMPL(z, n, f) \
-set_impl( BOOST_PP_CAT(f, n) ); \
-
-// end macro OVL_ASSIGN_TO
-
-#define OVL_SET(z, n, unused) \
-template< BOOST_PP_ENUM_PARAMS(n, typename F) > \
-this_type& set( BOOST_PP_ENUM_BINARY_PARAMS(n, F, const& _f) ) \
-{ \
- BOOST_PP_REPEAT(n, OVL_SET_IMPL, _f) \
- return *this; \
-} \
-
-// end macro OVL_CTOR
-
-#define OVL_CTOR(z, n, unused) \
-template< BOOST_PP_ENUM_PARAMS(n, typename F) > \
-overload( BOOST_PP_ENUM_BINARY_PARAMS(n, F, const& _f) ) \
-{ \
- set( BOOST_PP_ENUM_PARAMS(n, _f) ); \
-} \
+#define BOOST_OVERLOAD_MAKE_NTH_PARAM_WITH_A_DEFAULT(z, n, seq) \
+ BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, seq), n) = BOOST_PP_SEQ_ELEM(1, seq)
 
-// end macro OVL_CTOR
+#define BOOST_OVERLOAD_ENUM_SHIFTED_PARAMS_WITH_A_DEFAULT(n, param, dv) \
+ BOOST_PP_ENUM_SHIFTED(n, BOOST_OVERLOAD_MAKE_NTH_PARAM_WITH_A_DEFAULT, (param)(dv))
+
+#define BOOST_OVERLOAD_MAKE_NTH_CALL(z, n, seq) \
+ BOOST_PP_SEQ_ELEM(0, seq)BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, seq), n)BOOST_PP_SEQ_ELEM(2, seq)
+
+#define BOOST_OVERLOAD_ENUM_CALLS_TPL(n, func, arg, result) \
+ BOOST_PP_ENUM(n, BOOST_OVERLOAD_MAKE_NTH_CALL, (func<)(arg)(>::result))
+
+#define BOOST_OVERLOAD_MAKE_NTH_NUM_CALL(z, n, seq) \
+ BOOST_PP_SEQ_ELEM(0, seq) n BOOST_PP_SEQ_ELEM(1, seq)
+
+#define BOOST_OVERLOAD_ENUM_NUM_CALLS_TPL(n, func, result) \
+ BOOST_PP_ENUM(n, BOOST_OVERLOAD_MAKE_NTH_NUM_CALL, (func<)(>::result))
+
+#define BOOST_OVERLOAD_SET_IMPL(z, n, f) \
+ set_impl( BOOST_PP_CAT(f, n) );
+
+#define BOOST_OVERLOAD_SET(z, n, unused) \
+template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename F) > \
+this_type& set( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n), F, const& _f) ) \
+{ \
+ BOOST_PP_REPEAT(BOOST_PP_INC(n), BOOST_OVERLOAD_SET_IMPL, _f) \
+ return *this; \
+}
+// end macro BOOST_OVERLOAD_SET
+
+#define BOOST_OVERLOAD_CTOR(z, n, unused) \
+template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename F) > \
+overload( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n), F, const& _f) ) \
+{ \
+ set( BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), _f) ); \
+}
+// end macro BOOST_OVERLOAD_CTOR
+
+#define BOOST_OVERLOAD_MAKE_NTH_MAKE_OVERLOAD(z, n, unused) \
+template<BOOST_PP_ENUM_PARAMS(n, typename F)> \
+typename detail::make_overload_type<BOOST_PP_ENUM_PARAMS(n, F)>::type \
+make_overload(BOOST_PP_ENUM_BINARY_PARAMS(n, const F, & f)) \
+{ \
+ typedef typename detail::make_overload_type<BOOST_PP_ENUM_PARAMS(n, F)>::type \
+ overload_type; \
+ return overload_type(BOOST_PP_ENUM_PARAMS(n, f)); \
+}
+// end macro BOOST_OVERLOAD_MAKE_NTH_MAKE_OVERLOAD
+
+#define BOOST_OVERLOAD_FUNCTOR_ADAPTOR(result_type, func, template_param, signature, func_impl) \
+template<template_param> \
+result_type func( signature* _f_ptr ) \
+{ \
+ return func_impl< signature >( _f_ptr ); \
+} \
+\
+template<template_param> \
+result_type func( typename detail::memb_func_form< signature >::type _mf_ptr ) \
+{ \
+ return func_impl< signature >( _mf_ptr ); \
+} \
+ \
+template<template_param> \
+result_type func( typename detail::memb_func_form< signature, detail::const_>::type _mf_ptr ) \
+{ \
+ return func_impl< signature >( _mf_ptr ); \
+} \
+ \
+template<template_param, typename F> \
+result_type func( F const& _f, \
+ typename boost::disable_if< \
+ detail::is_ptr_or_memb_ptr_and_has_matching_signature< F, signature > \
+ >::type* = 0 ) \
+{ \
+ typedef typename detail::disambiguate< F, signature >::type cast_type; \
+ return func_impl< signature >( static_cast<cast_type>(_f) ); \
+}
+// end macro BOOST_OVERLOAD_FUNCTOR_ADAPTOR
 
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -53,18 +103,18 @@
 
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
 
-#define OVL_REAL_OR_DUMMY_SIG_M_N(z, m, n) \
+#define BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M_N(z, m, n) \
 typedef \
     typename detail::real_or_dummy_signature<n, BOOST_PP_CAT(Sig, n), m>::type \
     BOOST_PP_CAT(sig_, BOOST_PP_CAT(n, BOOST_PP_CAT(_, BOOST_PP_CAT(m, _t)))); \
 
-//end macro OVL_REAL_OR_DUMMY_SIG_M_N
+//end macro BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M_N
 
-#define OVL_REAL_OR_DUMMY_SIG_M(z, n, unused) \
-BOOST_PP_REPEAT(BOOST_OVERLOAD_MAX_NUM_ARGS, OVL_REAL_OR_DUMMY_SIG_M_N, n)
-// end macro OVL_REAL_OR_DUMMY_SIG_M
+#define BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M(z, n, unused) \
+BOOST_PP_REPEAT(BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M_N, n)
+// end macro BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M
 
-#define OVL_FC_OP_PARAM(z, m, tuple) \
+#define BOOST_OVERLOAD_FC_OP_PARAM(z, m, tuple) \
 typename detail::func_trait< \
     BOOST_PP_CAT(sig_, \
         BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, tuple), \
@@ -75,29 +125,31 @@
     ) \
>::BOOST_PP_CAT(arg, BOOST_PP_CAT(m, _type)) BOOST_PP_CAT(a, m) \
 
-// end macro OVL_FC_OP_PARAM
+// end macro BOOST_OVERLOAD_FC_OP_PARAM
 
-#define OVL_FUNC_CALL_OPERATOR_M_N(z, m, n) \
+#define BOOST_OVERLOAD_FUNC_CALL_OPERATOR_M_N(z, m, n) \
 typename detail::func_trait<BOOST_PP_CAT(Sig,n)>::result_type \
-operator() ( BOOST_PP_ENUM_SHIFTED(BOOST_PP_INC(m), OVL_FC_OP_PARAM, (n, m)) ) \
+operator() ( BOOST_PP_ENUM_SHIFTED(BOOST_PP_INC(m), BOOST_OVERLOAD_FC_OP_PARAM, (n, m)) ) \
 { \
     typedef \
         BOOST_PP_CAT(sig_,BOOST_PP_CAT(n,BOOST_PP_CAT(_,BOOST_PP_CAT(m, _t)))) \
         signature_type; \
- return boost::function<signature_type>:: \
+ return BOOST_OVERLOAD_WRAPPED_FUNC<signature_type>:: \
            operator()( BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(m), a) ); \
 } \
 
-// end macro OVL_FUNC_CALL_OPERATOR_M_N
+// end macro BOOST_OVERLOAD_FUNC_CALL_OPERATOR_M_N
 
-#define OVL_FUNC_CALL_OPERATORS(z, n, unused) \
-BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, OVL_FUNC_CALL_OPERATOR_M_N, n)
-// end macro OVL_FUNC_CALL_OPERATORS
+#define BOOST_OVERLOAD_FUNC_CALL_OPERATORS(z, n, unused) \
+BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_FUNC_CALL_OPERATOR_M_N, n)
+// end macro BOOST_OVERLOAD_FUNC_CALL_OPERATORS
 
 #endif
 // end workarounds for MSVC < 8.0 tested on MSVC 7.1
 ///////////////////////////////////////////////////////////////////////////////
 
+// so we can include the header responsible of undef macro once more
+#undef _BOOST_DETAIL_OVERLOAD_MACRO_UNDEF_HPP_
 
 #endif // _BOOST_OVERLOAD_DETAIL_MACRO_DEF_HPP_
 

Modified: sandbox/overload/trunk/boost/overload/detail/macro_undef.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/macro_undef.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/macro_undef.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,19 +13,28 @@
 
 // cleanup macro defs
 
-#undef OVL_CTOR
-#undef OVL_SET
-#undef OVL_SET_IMPL
-#undef OVL_TEMPL_PARAMS
-#undef OVL_DEFAULT_TEMPL_ARG
+#undef BOOST_OVERLOAD_FUNCTOR_ADAPTOR
+#undef BOOST_OVERLOAD_MAKE_NTH_MAKE_OVERLOAD
+#undef BOOST_OVERLOAD_CTOR
+#undef BOOST_OVERLOAD_SET
+#undef BOOST_OVERLOAD_SET_IMPL
+#undef BOOST_OVERLOAD_ENUM_SHIFTED_PARAMS_WITH_A_DEFAULT
+#undef BOOST_OVERLOAD_MAKE_NTH_PARAM_WITH_A_DEFAULT
+#undef BOOST_OVERLOAD_ENUM_NUM_CALLS_TPL
+#undef BOOST_OVERLOAD_MAKE_NTH_NUM_CALL
+#undef BOOST_OVERLOAD_ENUM_CALLS_TPL
+#undef BOOST_OVERLOAD_MAKE_NTH_CALL
+#undef BOOST_OVERLOAD_WRAPPED_FUNC
 
 // macro workarounds for MSVC < 8.0 tested on MSVC 7.1
-#undef OVL_FUNC_CALL_OPERATORS
-#undef OVL_FUNC_CALL_OPERATOR_M_N
-#undef OVL_FC_OP_PARAM
-#undef OVL_REAL_OR_DUMMY_SIG_M
-#undef OVL_REAL_OR_DUMMY_SIG_M_N
+#undef BOOST_OVERLOAD_FUNC_CALL_OPERATORS
+#undef BOOST_OVERLOAD_FUNC_CALL_OPERATOR_M_N
+#undef BOOST_OVERLOAD_FC_OP_PARAM
+#undef BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M
+#undef BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M_N
 
+// so we can include the header responsible of defining macro once more
+#undef _BOOST_OVERLOAD_DETAIL_MACRO_DEF_HPP_
 
 #endif // _BOOST_DETAIL_OVERLOAD_MACRO_UNDEF_HPP_
 

Modified: sandbox/overload/trunk/boost/overload/detail/member_function_form.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/member_function_form.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/member_function_form.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -16,7 +16,7 @@
 
 #include "member_function_trait.hpp"
 
-#define OVL_MEMB_FUNC_FORM(z, n, unused) \
+#define BOOST_OVERLOAD_MEMB_FUNC_FORM(z, n, unused) \
 template< typename ClassT, \
           typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A) > \
 struct memb_func_form< \
@@ -60,7 +60,7 @@
 { \
 }; \
 
-// end macro OVL_MEMB_FUNC_FORM
+// end macro BOOST_OVERLOAD_MEMB_FUNC_FORM
 
 namespace boost{ namespace overloads{ namespace detail{
 
@@ -76,15 +76,15 @@
     typedef typename boost::function_traits<Signature>::arg1_type arg_type;
     typedef typename boost::remove_pointer<arg_type>::type candidate_type;
   public:
- static const bool value
- = boost::is_class<candidate_type>::value
- && boost::is_pointer<arg_type>::value;
+ BOOST_STATIC_CONSTANT( bool, value
+ = (boost::is_class<candidate_type>::value
+ && boost::is_pointer<arg_type>::value) );
 };
 
 template< typename Signature >
 struct is_interface_func<Signature, 0>
 {
- static const bool value = false;
+ BOOST_STATIC_CONSTANT( bool, value = false );
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -100,11 +100,11 @@
 struct memb_func_form
 {};
 
-BOOST_PP_REPEAT(BOOST_OVERLOAD_LIMIT, OVL_MEMB_FUNC_FORM, unused)
+BOOST_PP_REPEAT(BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_MEMB_FUNC_FORM, unused)
 
 } } } // end namespaces
 
-#undef OVL_MEMB_FUNC_FORM
+#undef BOOST_OVERLOAD_MEMB_FUNC_FORM
 
 #endif // _BOOST_OVERLOAD_DETAIL_MEMBER_FUNCTION_FORM_HPP_
 

Modified: sandbox/overload/trunk/boost/overload/detail/member_function_trait.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/member_function_trait.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/member_function_trait.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,7 +13,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // member function traits
 
-#define OVL_MEMB_FUNC_TRAIT(z, n, unused) \
+#define BOOST_OVERLOAD_MEMB_FUNC_TRAIT(z, n, unused) \
 template< typename ClassT, \
           typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A) > \
 struct memb_func_trait< R (ClassT::*) ( BOOST_PP_ENUM_PARAMS(n, A) ) > \
@@ -25,7 +25,7 @@
     typedef R binded_type( ClassT* BOOST_PP_ENUM_TRAILING_PARAMS(n, A) ); \
     typedef \
         R const_binded_type(const ClassT* BOOST_PP_ENUM_TRAILING_PARAMS(n,A) );\
- static const bool const_qualified = false; \
+ BOOST_STATIC_CONSTANT( bool, const_qualified = false ); \
 }; \
                                                                                \
 template< typename ClassT, \
@@ -33,10 +33,10 @@
 struct memb_func_trait< R (ClassT::*) ( BOOST_PP_ENUM_PARAMS(n, A) ) const > \
     : memb_func_trait< R (ClassT::*) ( BOOST_PP_ENUM_PARAMS(n, A) ) > \
 { \
- static const bool const_qualified = true; \
+ BOOST_STATIC_CONSTANT( bool, const_qualified = true ); \
 }; \
 
-// end macro OVL_MEMB_FUNC_TRAIT
+// end macro BOOST_OVERLOAD_MEMB_FUNC_TRAIT
 
 
 namespace boost{ namespace overloads{ namespace detail{
@@ -45,11 +45,11 @@
 struct memb_func_trait
 {};
 
-BOOST_PP_REPEAT(BOOST_OVERLOAD_LIMIT, OVL_MEMB_FUNC_TRAIT, unused)
+BOOST_PP_REPEAT(BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_MEMB_FUNC_TRAIT, unused)
 
 } } } // end namespaces
 
-#undef OVL_MEMB_FUNC_TRAIT
+#undef BOOST_OVERLOAD_MEMB_FUNC_TRAIT
 
 #endif // _BOOST_OVERLOAD_DETAIL_MEMBER_FUNCTION_TRAIT_HPP_
 

Modified: sandbox/overload/trunk/boost/overload/detail/overload_base.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/overload_base.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/overload_base.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,16 +21,16 @@
 template<
     unsigned int N,
     typename Sig0,
- BOOST_PP_ENUM_SHIFTED(BOOST_OVERLOAD_LIMIT, OVL_TEMPL_PARAMS, Sig)
+ BOOST_OVERLOAD_ENUM_SHIFTED_PARAMS_WITH_A_DEFAULT(BOOST_OVERLOAD_LIMIT, typename Sig, detail::no_signature)
>
 struct overload_base
- : public boost::function<Sig0>
+ : public BOOST_OVERLOAD_WRAPPED_FUNC<Sig0>
     , public overload_base<N+1, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
 {
- static const unsigned int index = N;
+ BOOST_STATIC_CONSTANT( unsigned int, index = N );
 
- typedef Sig0 signature_type;
- typedef boost::function<Sig0> function_type;
+ typedef Sig0 signature_type;
+ typedef BOOST_OVERLOAD_WRAPPED_FUNC<Sig0> function_type;
     typedef
         overload_base<N+1, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
         base_type;
@@ -40,18 +40,25 @@
     using function_type::operator();
     using base_type::operator();
 #endif
+// Workaround for masking result_type inherited from boost::function
+// that leads to a problem for result_of support
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || BOOST_WORKAROUND(__INTEL_COMPILER, < 1220)
+ private:
+ template<typename T>
+ struct result_type;
+#endif
 };
 
 template< unsigned int N, typename Sig0 >
 struct overload_base<N, Sig0>
- : public boost::function<Sig0>
+ : public BOOST_OVERLOAD_WRAPPED_FUNC<Sig0>
     , public final_overload_base
 {
- static const unsigned int index = N;
+ BOOST_STATIC_CONSTANT( unsigned int, index = N );
 
- typedef Sig0 signature_type;
- typedef boost::function<Sig0> function_type;
- typedef final_overload_base base_type;
+ typedef Sig0 signature_type;
+ typedef BOOST_OVERLOAD_WRAPPED_FUNC<Sig0> function_type;
+ typedef final_overload_base base_type;
 
 // Workaround for MSVC < 8.0 tested on MSVC 7.1
 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)

Added: sandbox/overload/trunk/boost/overload/detail/result_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/boost/overload/detail/result_type.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,308 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_OVERLOAD_RESULT_TYPE_HPP_
+#define _BOOST_OVERLOAD_RESULT_TYPE_HPP_
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ #include "function_trait.hpp"
+#endif
+#include "trait_by_index.hpp"
+#include <boost/utility/enable_if.hpp>
+#include <boost/preprocessor/comma_if.hpp>
+
+
+#define BOOST_OVERLOAD_OVERLOAD_CANDIDATE(z, n, S) \
+ public overload_candidate<BOOST_PP_CAT(S,n), n>
+#define BOOST_OVERLOAD_OVERLOAD_CANDIDATE_INVOKE(z, n, S) \
+ using overload_candidate<BOOST_PP_CAT(S,n), n>::invoke;
+#define BOOST_OVERLOAD_OVERLOAD_CANDIDATE_DEF(z, n, unused) \
+template<unsigned int N, typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A)> \
+struct overload_candidate<R (BOOST_PP_ENUM_PARAMS(n, A) ), N> \
+{ \
+ typedef char index_type[N+1]; \
+ static index_type& invoke(BOOST_PP_ENUM_PARAMS(n, A) ); \
+};
+// end macro BOOST_OVERLOAD_OVERLOAD_CANDIDATE_DEF
+#define BOOST_OVERLOAD_ARG_N(z, n, unused) \
+ static BOOST_PP_CAT(A,n) BOOST_PP_CAT(arg,n);
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+#define BOOST_OVERLOAD_INDEX_OF_BEST_OVERLOAD_CANDIDATE_DEF(z, n, unused) \
+template<typename Candidates, typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A)> \
+struct index_of_best_overload_candidate<R (BOOST_PP_ENUM_PARAMS(n, A) ), Candidates> \
+{ \
+ BOOST_PP_REPEAT(n, BOOST_OVERLOAD_ARG_N, unused) \
+ BOOST_STATIC_CONSTANT( unsigned int, value = ((sizeof(Candidates::invoke(BOOST_PP_ENUM_PARAMS(n, arg))) / sizeof(char)) - 1) ); \
+};
+#else
+#define BOOST_OVERLOAD_INDEX_OF_BEST_OVERLOAD_CANDIDATE_DEF(z, n, unused) \
+template<typename Candidates, typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A)> \
+struct index_of_best_overload_candidate<R (BOOST_PP_ENUM_PARAMS(n, A) ), Candidates> \
+{ \
+ BOOST_PP_REPEAT(n, BOOST_OVERLOAD_ARG_N, unused) \
+ static arity_type<n> arity_object; \
+ BOOST_STATIC_CONSTANT( unsigned int, value = ((sizeof(Candidates::invoke( BOOST_PP_ENUM_PARAMS(n, arg) BOOST_PP_COMMA_IF(n) arity_object )) / sizeof(char)) - 1) ); \
+};
+// end macro BOOST_OVERLOAD_INVOKER_DEF
+#endif
+
+
+namespace boost{ namespace overloads{ namespace detail{
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+///////////////////////////////////////////////////////////////////////////////
+// class: overload_candidate<S, N>
+// requires: S is a call signature (that is a function type)
+// N is a positive integer
+// provides: defines a static member function 'invoke' with parameter types
+// the same specified in the call signature S and with result type
+// a type R such that sizeof(R) == (N * sizeof(char))
+
+
+template<typename S, unsigned int N>
+struct overload_candidate
+{
+};
+
+template<unsigned int N>
+struct overload_candidate<no_signature, N>
+{
+ struct dummy_type;
+ template<typename T>
+ static void invoke(dummy_type );
+};
+
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_OVERLOAD_MAX_NUM_ARGS), BOOST_OVERLOAD_OVERLOAD_CANDIDATE_DEF, unused)
+
+///////////////////////////////////////////////////////////////////////////////
+// class: overload_candidate_set<S0, ..., SN>
+// requires: S0, ..., SN are call signatures (that is function types)
+// provides: inherits from each overload_candidate<SK, K> and exposes an
+// 'invoke' static member function for each call signature SK.
+
+template<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename S)>
+struct overload_candidate_set
+ : BOOST_PP_ENUM(BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_OVERLOAD_CANDIDATE, S)
+{
+ BOOST_PP_REPEAT(BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_OVERLOAD_CANDIDATE_INVOKE, S)
+};
+
+#else // BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+
+///////////////////////////////////////////////////////////////////////////////
+// helper macros
+
+#define BOOST_OVERLOAD_GET_ARG_BY_INDEX(z, n, unused) \
+template<typename SignatureTraits> \
+struct get_arg_by_index<n, SignatureTraits> \
+{ \
+ typedef typename SignatureTraits::BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type) type; \
+}; \
+BOOST_PP_EMPTY()
+// end macro BOOST_OVERLOAD_GET_ARG_BY_INDEX
+
+#define BOOST_OVERLOAD_INVOKE_SIG_TRAITS(m) \
+ BOOST_PP_CAT(BOOST_PP_CAT(sig, m), _traits)
+
+#define BOOST_OVERLOAD_INVOKE_RESULT_TYPE(m) \
+ BOOST_PP_CAT(BOOST_PP_CAT(result, m), _type)
+
+#define BOOST_OVERLOAD_INVOKE_ARG_TYPE(m, n) \
+ BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(arg_, m), _), n), _type)
+
+#define BOOST_OVERLOAD_INVOKE_ARG_TYPE_M(z, n, m) \
+ BOOST_OVERLOAD_INVOKE_ARG_TYPE(m, n)
+
+#define BOOST_OVERLOAD_INVOKE_ARG_TYPEDEF(z, n, m) \
+ typedef typename get_arg_type<n, BOOST_OVERLOAD_INVOKE_SIG_TRAITS(m), m>::type BOOST_OVERLOAD_INVOKE_ARG_TYPE(m, n); \
+ BOOST_PP_EMPTY()
+// end macro BOOST_OVERLOAD_INVOKE_ARG_TYPEDEF
+
+#define BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET_INVOKE(z, m, n) \
+ typedef func_trait<BOOST_PP_CAT(S, m)> BOOST_OVERLOAD_INVOKE_SIG_TRAITS(m); \
+ BOOST_PP_REPEAT(n, BOOST_OVERLOAD_INVOKE_ARG_TYPEDEF, m) \
+ typedef char BOOST_OVERLOAD_INVOKE_RESULT_TYPE(m)[BOOST_PP_INC(m)]; \
+ static BOOST_OVERLOAD_INVOKE_RESULT_TYPE(m) & \
+ invoke( BOOST_PP_ENUM(n, BOOST_OVERLOAD_INVOKE_ARG_TYPE_M, m) BOOST_PP_COMMA_IF(n) arity_type<BOOST_OVERLOAD_INVOKE_SIG_TRAITS(m)::arity> ); \
+ BOOST_PP_EMPTY() \
+ BOOST_PP_EMPTY()
+// end macro BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET_INVOKE
+
+#define BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET(z, n, unused) \
+template<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename S)> \
+struct overload_candidate_set<n, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, S)> \
+{ \
+ BOOST_PP_REPEAT(BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET_INVOKE, n) \
+}; \
+BOOST_PP_EMPTY()
+// end macro BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET
+
+///////////////////////////////////////////////////////////////////////////////
+// class: arity_type<N>
+// provides: a tag type for discriminating call signature arities
+
+template<unsigned int N> struct arity_type {};
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunction: get_arg_by_index<N, SignatureTraits>
+// requires: N is a non-negative integer, SignatureTraits is a class
+// template that is derived from boost::function_traits
+// returns: the N+1 argument type as reported by SignatureTraits
+
+template<unsigned int N, typename SignatureTraits>
+struct get_arg_by_index
+{
+};
+
+BOOST_PP_REPEAT(BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_GET_ARG_BY_INDEX, unused)
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunction: get_arg_type<ArgIndex, SignatureTraits, SigIndex>
+// requires: ArgIndex and SigIndex are a non-negative integers,
+// SignatureTraits is a class template that is derived from
+// boost::function_traits
+// returns: the type of the ArgIndex+1 argument as reported by
+// SignatureTraits if ArgIndex < SignatureTraits::arity,
+// dummy_type otherwise
+
+template<
+ unsigned int ArgIndex,
+ typename SignatureTraits,
+ unsigned int SigIndex,
+ bool IsOverRequiredArity = (ArgIndex >= SignatureTraits::arity)
+ >
+struct get_arg_type
+{
+ typedef typename get_arg_by_index<ArgIndex, SignatureTraits>::type type;
+};
+
+template<
+ unsigned int ArgIndex,
+ typename SignatureTraits,
+ unsigned int SigIndex
+ >
+struct get_arg_type<ArgIndex, SignatureTraits, SigIndex, true>
+{
+ struct dummy_type;
+ typedef dummy_type type;
+};
+
+template<
+ unsigned int ArgIndex,
+ unsigned int SigIndex
+ >
+struct get_arg_type<ArgIndex, func_trait<no_signature>, SigIndex, false>
+{
+ struct dummy_type;
+ typedef dummy_type type;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// class: overload_candidate_set<RequiredArity, S0, ..., SN>
+// requires: S0, ..., SN are call signatures (that is function types)
+// RequiredArity is a non-negative integer
+// provides: defines a static member function 'invoke' for each call
+// signature SK with parameter types the same ones specified in
+// the call signature SK and with result type a type RK such that
+// sizeof(RK) == ((K+1) * sizeof(char))
+
+template<unsigned int RequiredArity, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename S)>
+struct overload_candidate_set
+{
+};
+
+BOOST_PP_REPEAT(BOOST_OVERLOAD_MAX_NUM_ARGS, BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET, unused)
+
+
+#undef BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET
+#undef BOOST_OVERLOAD_OVERLOAD_CANDIDATE_SET_INVOKE
+#undef BOOST_OVERLOAD_INVOKE_ARG_TYPEDEF
+#undef BOOST_OVERLOAD_INVOKE_ARG_TYPE_M
+#undef BOOST_OVERLOAD_INVOKE_ARG_TYPE
+#undef BOOST_OVERLOAD_INVOKE_RESULT_TYPE
+#undef BOOST_OVERLOAD_INVOKE_SIG_TRAITS
+#undef BOOST_OVERLOAD_GET_ARG_BY_INDEX
+
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunction: index_of_best_overload_candidate<ArgsType, Candidates>
+// requires: ArgsType is a function type R (A0, A1, ..., AN) where
+// A0, ..., AN are the arguments of the required function call,
+// Candidates is an instantiation of the overload_candidate_set
+// class template
+// returns: the index of the best overload candidate included into
+// the ordered overload set Candidates
+
+template<typename ArgsType, typename Candidates>
+struct index_of_best_overload_candidate
+{
+};
+
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_OVERLOAD_MAX_NUM_ARGS), BOOST_OVERLOAD_INDEX_OF_BEST_OVERLOAD_CANDIDATE_DEF, unused)
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunction: index_of_best_viable_function<ArgsType, Overload>
+// requires: ArgsType is a function type R (A0, A1, ..., AN) where
+// A0, ..., AN are the arguments of the required function call,
+// Overload is an instantiation of the boost::overload class
+// template
+// returns: the index of the call signature of the best viable function
+// supported by Overload respect with the arguments specified in
+// ArgsType, or a compile-time error if the best viable
+// function can not be determined
+
+template<typename ArgsType, typename Overload>
+struct index_of_best_viable_function
+{
+ private:
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ typedef typename Overload::overload_candidate_set candidates_type;
+#else
+ typedef typename Overload::template overload_candidate_set<ArgsType>::type
+ candidates_type;
+#endif
+ typedef index_of_best_overload_candidate<ArgsType, candidates_type>
+ index_type;
+ public:
+ BOOST_STATIC_CONSTANT( unsigned int, value = (index_type::value) );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunction: result<CallType>
+// requires: CallType is a function type F (A0, A1, ..., AN) where
+// F is an instantiation of the boost::overload class template
+// returns: the result type of the best viable function supported by F
+// respect with the arguments specified in CallType or a compiler
+// error if the best viable function can not be determined
+// provides: support for Boost.ResultOf
+
+template<typename CallType>
+struct result
+{
+ private:
+ typedef typename boost::function_traits<CallType>::result_type overload_type;
+ BOOST_STATIC_CONSTANT( unsigned int, index =
+ (index_of_best_viable_function<CallType, overload_type>::value) );
+ typedef typename signature<index, overload_type>::type signature;
+ public:
+ typedef typename boost::function_traits<signature>::result_type type;
+};
+
+} } } // end namespaces
+
+
+#undef BOOST_OVERLOAD_INDEX_OF_BEST_OVERLOAD_CANDIDATE_DEF
+#undef BOOST_OVERLOAD_ARG_N
+#undef BOOST_OVERLOAD_OVERLOAD_CANDIDATE_DEF
+#undef BOOST_OVERLOAD_OVERLOAD_CANDIDATE_INVOKE
+#undef BOOST_OVERLOAD_OVERLOAD_CANDIDATE
+
+
+#endif // _BOOST_OVERLOAD_RESULT_TYPE_HPP_

Modified: sandbox/overload/trunk/boost/overload/detail/trait_by_functor.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/trait_by_functor.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/trait_by_functor.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -46,6 +46,31 @@
 };
 
 ///////////////////////////////////////////////////////////////////////////////
+// it provides the total amount of signatures supported by both an overload
+// type and a functor
+
+template<
+ typename Functor,
+ typename Overload,
+ bool FOUND
+ = functor_has_signature<Functor, typename Overload::base_type::signature_type >::value
+>
+struct number_of_shared_signatures
+{
+ private:
+ typedef typename Overload::base_type base_type;
+ typedef number_of_shared_signatures<Functor, base_type> type;
+ public:
+ BOOST_STATIC_CONSTANT( int, value = (FOUND + type::value) );
+};
+
+template< typename Functor, bool FOUND >
+struct number_of_shared_signatures<Functor, final_overload_base, FOUND>
+{
+ BOOST_STATIC_CONSTANT( int, value = 0 );
+};
+
+///////////////////////////////////////////////////////////////////////////////
 // it provides the first signature of an overload type that matches with
 // the functor signature, if it's not found it returns no_signature as type
 
@@ -76,8 +101,8 @@
 template< typename Functor, typename Overload >
 struct index_by_functor
 {
- static const unsigned int value
- = base_by_functor<Functor, Overload>::type::index;
+ BOOST_STATIC_CONSTANT( unsigned int, value
+ = (base_by_functor<Functor, Overload>::type::index) );
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -85,11 +110,11 @@
 // an overload type
 
 template< typename Functor, typename Overload >
-struct has_functor_signature
+struct have_any_shared_signature
 {
- static const bool value
+ BOOST_STATIC_CONSTANT( bool, value
         = !( index_by_functor<Functor, Overload>::value
- == final_overload_base::index );
+ == final_overload_base::index ) );
 };
 
 } } } // end namespaces

Modified: sandbox/overload/trunk/boost/overload/detail/trait_by_index.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/trait_by_index.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/trait_by_index.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,13 +22,13 @@
   private:
     typedef typename Overload::base_type base;
   public:
- static const int value = extent<base>::value + 1;
+ BOOST_STATIC_CONSTANT( int, value = (extent<base>::value + 1) );
 };
 
 template<>
 struct extent<final_overload_base>
 {
- static const int value = final_overload_base::index;
+ BOOST_STATIC_CONSTANT( int, value = (final_overload_base::index) );
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -48,6 +48,12 @@
     typedef typename Overload::base_type type;
 };
 
+template< unsigned int N, bool FOUND >
+struct base_by_idx<N, final_overload_base, FOUND>
+{
+ typedef final_overload_base type;
+};
+
 ///////////////////////////////////////////////////////////////////////////////
 // it provides the N-th signature for an overload type
 

Modified: sandbox/overload/trunk/boost/overload/detail/trait_by_signature.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/detail/trait_by_signature.hpp (original)
+++ sandbox/overload/trunk/boost/overload/detail/trait_by_signature.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -49,9 +49,10 @@
 // it provedes the index of a signature, and returns -1 if it's not found
 
 template< typename Sig, typename Overload >
-struct index
+struct index_of_signature
 {
- static const unsigned int value = base_by_sig<Sig, Overload>::type::index;
+ BOOST_STATIC_CONSTANT( unsigned int, value
+ = (base_by_sig<Sig, Overload>::type::index) );
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -60,8 +61,9 @@
 template< typename Sig, typename Overload >
 struct has_signature
 {
- static const bool value
- = !( index<Sig, Overload>::value == final_overload_base::index );
+ BOOST_STATIC_CONSTANT( bool, value
+ = !( index_of_signature<Sig, Overload>::value
+ == final_overload_base::index ) );
 };
 
 } } } // end namespaces

Added: sandbox/overload/trunk/boost/overload/make_overload.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/boost/overload/make_overload.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_OVERLOAD_MAKE_OVERLOAD_HPP_
+#define _BOOST_OVERLOAD_MAKE_OVERLOAD_HPP_
+
+
+#include "config.hpp"
+
+#include <boost/detail/workaround.hpp>
+
+#include "detail/macro_def.hpp"
+#include "make_overload_impl.hpp"
+#include "detail/macro_undef.hpp"
+
+
+#endif // _BOOST_OVERLOAD_MAKE_OVERLOAD_HPP_

Added: sandbox/overload/trunk/boost/overload/make_overload_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/boost/overload/make_overload_impl.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,54 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_MAKE_OVERLOAD_IMPL_HPP_
+#define _BOOST_MAKE_OVERLOAD_IMPL_HPP_
+
+
+#include "overload_impl.hpp"
+#include "detail/get_signature.hpp"
+
+
+namespace boost{ namespace overloads{
+
+namespace detail {
+
+struct no_function {};
+
+template<>
+struct get_signature<no_function, function_obj_tag>
+{
+ typedef no_signature type;
+};
+
+
+template<
+ typename F0,
+ BOOST_OVERLOAD_ENUM_SHIFTED_PARAMS_WITH_A_DEFAULT(BOOST_OVERLOAD_LIMIT, typename F, no_function)
+>
+struct make_overload_type
+{
+ typedef overload< BOOST_OVERLOAD_ENUM_CALLS_TPL(BOOST_OVERLOAD_LIMIT, typename get_signature, F, type) >
+ type;
+};
+
+} // end namespace detail
+
+
+BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_OVERLOAD_LIMIT), BOOST_OVERLOAD_MAKE_NTH_MAKE_OVERLOAD, unused)
+
+using detail::make_overload_type;
+
+} // end overloads namespace
+
+using overloads::make_overload;
+
+} // end boost namespace
+
+
+#endif // _BOOST_MAKE_OVERLOAD_IMPL_HPP_

Modified: sandbox/overload/trunk/boost/overload/overload_impl.hpp
==============================================================================
--- sandbox/overload/trunk/boost/overload/overload_impl.hpp (original)
+++ sandbox/overload/trunk/boost/overload/overload_impl.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2007 Marco Cecchetti
+ Copyright (c) 2007-2012 Marco Cecchetti
 
     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -9,11 +9,21 @@
 #ifndef _BOOST_OVERLOAD_IMPL_HPP_
 #define _BOOST_OVERLOAD_IMPL_HPP_
 
+#include <boost/static_assert.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/type_traits/function_traits.hpp>
+
 #include "detail/overload_base.hpp"
 #include "detail/trait_by_index.hpp"
 #include "detail/trait_by_signature.hpp"
 #include "detail/trait_by_functor.hpp"
 #include "detail/member_function_form.hpp"
+#include "detail/result_type.hpp"
+
+#if defined(BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT)
+ #include "detail/lambda_result_type_support.hpp"
+#endif
 
 #ifdef BOOST_MSVC
 # pragma warning(push)
@@ -28,22 +38,71 @@
 
 namespace boost{ namespace overloads{
 
-using detail::extent;
-using detail::signature;
-using detail::function;
-using detail::index;
-using detail::has_signature;
-using detail::has_functor_signature;
-
 using detail::const_;
 using detail::non_const;
 
+template<
+ BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)
+>
+//template< typename Sig0, typename Sig1 = no_signature, ... >
+class overload;
+
+namespace detail {
+
+template<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+class get_function_tag< overloads::overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)> >
+{
+ public:
+ typedef function_obj_tag type;
+};
+
+template<
+ BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig),
+ typename Sig>
+struct functor_has_signature< overloads::overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>, Sig, function_obj_tag >
+{
+ typedef overloads::overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)> overload_type;
+ BOOST_STATIC_CONSTANT( bool, value = (has_signature<Sig, overload_type>::value) );
+};
+
+template< typename F >
+struct is_overload
+{
+ BOOST_STATIC_CONSTANT( bool, value = false );
+};
+
+template< BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig) >
+struct is_overload<
+ overloads::overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+>
+{
+ BOOST_STATIC_CONSTANT( bool, value = true );
+};
+
+template< typename F, typename Signature >
+struct disambiguate
+{
+ typedef F type;
+};
+
+template< BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig),
+ typename Signature>
+struct disambiguate<
+ overloads::overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>,
+ Signature>
+{
+ typedef const BOOST_OVERLOAD_WRAPPED_FUNC<Signature> & type;
+};
+
+} // end namespace detail
+
+
 ///////////////////////////////////////////////////////////////////////////////
 // overload class template
 
 template<
     typename Sig0,
- BOOST_PP_ENUM_SHIFTED(BOOST_OVERLOAD_LIMIT, OVL_TEMPL_PARAMS, Sig)
+ BOOST_OVERLOAD_ENUM_SHIFTED_PARAMS_WITH_A_DEFAULT(BOOST_OVERLOAD_LIMIT, typename Sig, detail::no_signature)
>
 //template< typename Sig0, typename Sig1 = no_signature, ... >
 class overload
@@ -58,42 +117,82 @@
         detail::overload_base<0,BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
         base_type;
 
+ // wrapped function type
+ template <typename Signature>
+ struct wrapped_function
+ {
+ typedef BOOST_OVERLOAD_WRAPPED_FUNC<Signature> type;
+ };
+
     // static const unsigned int extent = overloads::extent<this_type>::value;
     static const unsigned int extent;
 
     template< unsigned int N >
     struct signature
     {
- typedef typename overloads::signature<N, this_type>::type type;
+ typedef typename detail::signature<N, this_type>::type type;
     };
 
     template< unsigned int N >
     struct function
     {
- typedef typename overloads::function< N, this_type >::type type;
+ typedef typename detail::function< N, this_type >::type type;
     };
 
     template< typename Sig >
- struct index
+ struct index_of_signature
     {
- static const unsigned int value
- = overloads::index<Sig, this_type>::value;
+ BOOST_STATIC_CONSTANT( int, value =
+ (static_cast<int>(detail::index_of_signature<Sig, this_type>::value)) );
     };
 
     template< typename Sig >
     struct has_signature
     {
- static const bool value
- = overloads::has_signature<Sig, this_type>::value;
+ BOOST_STATIC_CONSTANT( bool, value =
+ (detail::has_signature<Sig, this_type>::value) );
     };
 
     template< typename F >
- struct has_functor_signature
+ struct shares_any_signature_with
     {
- static const bool value
- = overloads::has_functor_signature<F, this_type>::value;
+ BOOST_STATIC_CONSTANT( bool, value =
+ (detail::have_any_shared_signature<F, this_type>::value) );
     };
 
+ ///////////////////////////////////////////////////////////////////////////
+ // ResultOf library support
+
+ template<typename ArgsType, typename Overload>
+ friend struct detail::index_of_best_viable_function;
+
+ private:
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ typedef detail::overload_candidate_set<BOOST_OVERLOAD_ENUM_NUM_CALLS_TPL(BOOST_OVERLOAD_LIMIT, typename signature, type)>
+ overload_candidate_set;
+#else
+ template<typename ArgsType>
+ struct overload_candidate_set
+ {
+ BOOST_STATIC_CONSTANT( unsigned int, arity = (boost::function_traits<ArgsType>::arity) );
+ typedef detail::overload_candidate_set<arity, BOOST_OVERLOAD_ENUM_NUM_CALLS_TPL(BOOST_OVERLOAD_LIMIT, typename signature, type)>
+ type;
+ };
+#endif
+
+ public:
+ template<typename CallType>
+ struct result : public detail::result<CallType>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Lambda library support
+#if defined(BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT)
+ template<typename Args>
+ struct sig : public detail::sig<Args>
+ {};
+#endif
+
   private:
     ///////////////////////////////////////////////////////////////////////////
     // Workaround for MSVC < 8.0 tested on MSVC 7.1
@@ -106,7 +205,7 @@
>::type
         zero_arity_signature_type;
 
- BOOST_PP_REPEAT(BOOST_OVERLOAD_LIMIT, OVL_REAL_OR_DUMMY_SIG_M, unused)
+ BOOST_PP_REPEAT(BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_REAL_OR_DUMMY_SIG_M, unused)
 #endif
 
   public:
@@ -115,9 +214,43 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
+ // workaround for MSVC compilers
+ // copy constructor and copy assignment operator need to be defined
+ // explicitly or we get some kind of 'ambiguos' error;
+ // tested with MSVC 7.1, 8.0, 9.0, 10.0
+#ifdef BOOST_MSVC
+ overload( const this_type & _f )
+ {
+ copy_impl< detail::extent<this_type>::value - 1 >( _f );
+ }
+
+ this_type& operator=( const this_type & _f )
+ {
+ copy_impl< detail::extent<this_type>::value - 1 >( _f );
+ return *this;
+ }
+
+ private:
+ template<unsigned int N>
+ void copy_impl( const this_type & _f )
+ {
+ get<N>() = _f.get<N>();
+ copy_impl<N-1>( _f );
+ }
+
+ template<>
+ void copy_impl<0>( const this_type & _f )
+ {
+ get<0>() = _f.get<0>();
+ }
+
+ public:
+#endif
+
+ ///////////////////////////////////////////////////////////////////////////
     // constructors and methods that supports signature deduction
  
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_LIMIT, OVL_CTOR, unused)
+ BOOST_PP_REPEAT_FROM_TO(0, BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_CTOR, unused)
 
     template< typename F >
     this_type& set( F const& _f,
@@ -125,11 +258,12 @@
                         boost::is_pointer<F>
>::type* = 0 )
     {
+ BOOST_STATIC_ASSERT(( shares_any_signature_with<F>::value ));
         set_impl(_f);
         return *this;
     }
 
- BOOST_PP_REPEAT_FROM_TO(2, BOOST_OVERLOAD_LIMIT, OVL_SET, unused)
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_SET, unused)
 
     ///////////////////////////////////////////////////////////////////////////
     // Workaround for MSVC < 8.0 tested on MSVC 7.1
@@ -139,19 +273,67 @@
         typename detail::func_trait< zero_arity_signature_type >::result_type
         operator() ()
     {
- return boost::function<zero_arity_signature_type>::operator()();
+ return BOOST_OVERLOAD_WRAPPED_FUNC<zero_arity_signature_type>::operator()();
         }
 
- BOOST_PP_REPEAT_FROM_TO(0, BOOST_OVERLOAD_LIMIT, OVL_FUNC_CALL_OPERATORS, Sig)
+ BOOST_PP_REPEAT_FROM_TO(0, BOOST_OVERLOAD_LIMIT, BOOST_OVERLOAD_FUNC_CALL_OPERATORS, Sig)
+#endif
+
+ ///////////////////////////////////////////////////////////////////////////
+ // set the passed target for all compatible signatures
+
+ template< typename F >
+ this_type& set_for_each_shared_signature( F const& _f,
+ typename boost::enable_if<
+ detail::is_ptr_or_memb_ptr<F>
+ >::type* = 0 )
+ {
+ BOOST_STATIC_ASSERT(( shares_any_signature_with<F>::value ));
+ set_impl(_f);
+ return *this;
+ }
+
+ template< typename F >
+ this_type& set_for_each_shared_signature( F const& _f,
+ typename boost::disable_if<
+ detail::is_ptr_or_memb_ptr<F>
+ >::type* = 0 )
+ {
+ ///////////////////////////////////////////////////////////////////////
+ // Workaround for MSVC 8.0
+ // When we have a template function and a *single* explicit overload
+ // ( e.g. T foo(T ) and int foo(int ) ) we do not get any compile time
+ // error, instead we expect to get a compile time error pointing out
+ // that the function is overloaded. What happens is that the template
+ // parameter F is tied to the function type of the single explicit
+ // overload (e.g. F is equal to int(int ) in our example); pay attention
+ // here F results of type 'function' not of type 'pointer to function',
+ // so we use the following static assertion for pointing out the problem
+
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1400)
+ BOOST_STATIC_ASSERT(( !boost::is_function<F>::value ));
 #endif
+ BOOST_STATIC_ASSERT(( shares_any_signature_with<F>::value ));
+ set_for_each_shared_signature_impl(_f);
+ return *this;
+ }
 
     ///////////////////////////////////////////////////////////////////////////
- // swap two boost::functions
+ // swap two boost::overloads
+
+ void swap( this_type& _f )
+ {
+ swap_impl<base_type>(_f, this);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // swap two wrapped functions with the same call signature
 
     template< typename Sig >
- void swap_function( boost::function<Sig>& _f )
+ void swap_function( BOOST_OVERLOAD_WRAPPED_FUNC<Sig>& _f )
     {
- boost::function<Sig>::swap(_f);
+ typedef typename wrapped_function<Sig>::type function_type;
+ function_type::swap(_f);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -165,47 +347,57 @@
     ///////////////////////////////////////////////////////////////////////////
     // return true if all the callable targets are empty
 
- bool empty_all()
+ bool empty_all() const
     {
         return empty_all_impl<typename this_type::base_type>(this);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // signature based methods
+ // return true if any the callable target is empty
 
- template< typename Sig >
- const boost::function<Sig>& get() const
+ bool empty_any() const
     {
- return *this;
+ return empty_any_impl<typename this_type::base_type>(this);
     }
 
- template< typename Sig >
- boost::function<Sig>& get()
+ ///////////////////////////////////////////////////////////////////////////
+ // return true if no callable target is empty
+
+ bool empty_none() const
     {
- return *this;
+ return !empty_any();
     }
 
- template<typename Sig>
- this_type& set( Sig* _f_ptr )
+ ///////////////////////////////////////////////////////////////////////////
+ // return true if the functor if the functor is contained in at least one
+ // of the internal function object
+
+ template< typename F >
+ bool contains( const F & f ) const
     {
- get<Sig>() = _f_ptr;
- return *this;
+ typedef typename detail::base_by_functor<F, this_type>::type base_type;
+ return contains_impl<base_type, F>(this, f);
     }
 
- template<typename Sig>
- this_type& set( typename detail::memb_func_form<Sig>::type _mf_ptr )
+ ///////////////////////////////////////////////////////////////////////////
+ // signature based methods
+
+ template< typename Sig >
+ const typename wrapped_function<Sig>::type& get() const
     {
- get<Sig>() = _mf_ptr;
+ BOOST_STATIC_ASSERT(( has_signature<Sig>::value ));
         return *this;
     }
 
- template<typename Sig>
- this_type& set( typename detail::memb_func_form<Sig, const_>::type _mf_ptr )
+ template< typename Sig >
+ typename wrapped_function<Sig>::type& get()
     {
- get<Sig>() = _mf_ptr;
+ BOOST_STATIC_ASSERT(( has_signature<Sig>::value ));
         return *this;
     }
 
+ BOOST_OVERLOAD_FUNCTOR_ADAPTOR( this_type&, set, typename Sig, Sig, set_by_signature )
+
     template<typename Sig, typename const_qlf >
     this_type& set( typename detail::memb_func_form<Sig, const_qlf>::type _mf_ptr )
     {
@@ -213,26 +405,18 @@
         return *this;
     }
 
- template< typename Sig, typename F >
- this_type& set( F const& _f,
- typename boost::disable_if<
- detail::is_ptr_or_memb_ptr<F>
- >::type* = 0 )
- {
- get<Sig>() = _f;
- return *this;
- }
-
     template< typename Sig >
     bool empty() const
     {
- return boost::function<Sig>::empty();
+ typedef typename wrapped_function<Sig>::type function_type;
+ return function_type::empty();
     }
 
     template< typename Sig >
     void clear()
     {
- boost::function<Sig>::clear();
+ typedef typename wrapped_function<Sig>::type function_type;
+ function_type::clear();
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -250,12 +434,7 @@
         return *this;
     }
 
- template< unsigned int N, typename F >
- this_type& set( F const& _f )
- {
- get<N>() = _f;
- return *this;
- }
+ BOOST_OVERLOAD_FUNCTOR_ADAPTOR( this_type&, set, int N, typename signature<N>::type, set_by_signature )
 
     template< unsigned int N >
     bool empty() const
@@ -277,21 +456,33 @@
     //
 
     template< typename Sig >
- void set_impl( boost::function<Sig> const& _f )
+ void set_impl( BOOST_OVERLOAD_WRAPPED_FUNC<Sig> const& _f )
     {
- boost::function<Sig>::operator=(_f);
+ typedef typename wrapped_function<Sig>::type function_type;
+ function_type::operator=(_f);
     }
 
     template< typename F >
- void set_impl(
- F const& _f,
- typename boost::enable_if< has_functor_signature<F> >::type* = 0
- )
+ void set_impl( F const& _f,
+ typename boost::enable_if<
+ detail::is_ptr_or_memb_ptr<F>
+ >::type* = 0 )
     {
- typedef
- typename
- detail::base_by_functor<F, this_type>::type
- base_type;
+ typedef typename detail::base_by_functor<F, this_type>::type
+ base_type;
+
+ set_impl<F, base_type>(_f, this);
+ }
+
+ template< typename F >
+ void set_impl( F const& _f,
+ typename boost::disable_if<
+ detail::is_ptr_or_memb_ptr<F>
+ >::type* = 0 )
+ {
+ BOOST_STATIC_ASSERT(( detail::number_of_shared_signatures<F, this_type>::value == 1 ));
+ typedef typename detail::base_by_functor<F, this_type>::type
+ base_type;
 
         set_impl<F, base_type>(_f, this);
     }
@@ -299,26 +490,98 @@
     template< typename F, typename Base >
     void set_impl( F const& _f, Base const* )
     {
- //std::cout << "set_impl" << std::endl;
- typedef
- typename
- detail::base_by_functor<F, Base>::type
- base_type;
         typedef typename Base::signature_type signature_type;
+ typedef typename detail::disambiguate<F, signature_type>::type
+ cast_type;
+ typedef typename wrapped_function<signature_type>::type function_type;
 
- set<signature_type>(_f);
- set_impl<F, base_type>(_f, this);
+ function_type::operator=( static_cast<cast_type>(_f) );
+ }
+
+ // TODO: probably not needed
+ template< typename F, typename Base>
+ void set_impl( F const& , detail::final_overload_base const* )
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // function set_by_signature
+ //
+
+ template< typename Sig, typename F >
+ this_type& set_by_signature( F const& _f )
+ {
+ get<Sig>() = _f;
+ return *this;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // function set_target_for_all_compatible_signatures_impl
+ //
+
+ template< typename Sig >
+ void set_for_each_shared_signature_impl( BOOST_OVERLOAD_WRAPPED_FUNC<Sig> const& _f )
+ {
+ typedef typename wrapped_function<Sig>::type function_type;
+ function_type::operator=(_f);
+ }
+
+ template< typename F >
+ void set_for_each_shared_signature_impl(
+ F const& _f,
+ typename boost::enable_if< shares_any_signature_with<F> >::type* = 0
+ )
+ {
+ typedef typename detail::base_by_functor<F, this_type>::type
+ base_type;
+
+ set_for_each_shared_signature_impl<F, base_type>(_f, this);
+ }
+
+ template< typename F, typename Base >
+ void set_for_each_shared_signature_impl( F const& _f, Base const* )
+ {
+ typedef typename detail::base_by_functor<F, Base>::type
+ base_type;
+ typedef typename Base::signature_type signature_type;
+ typedef typename detail::disambiguate<F, signature_type>::type
+ cast_type;
+ typedef typename wrapped_function<signature_type>::type function_type;
+
+ function_type::operator=( static_cast<cast_type>(_f) );
+ set_for_each_shared_signature_impl<F, base_type>(_f, this);
     }
 
     template< typename F, typename Base>
- void set_impl( F const& ,
+ void set_for_each_shared_signature_impl(
+ F const& ,
+ detail::final_overload_base const*
+ )
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // function clear_all_impl
+
+ template< typename Base >
+ void swap_impl(this_type & _f, Base const*)
+ {
+ typedef typename Base::base_type base_type;
+ typedef typename Base::signature_type signature_type;
+ typedef typename wrapped_function<signature_type>::type function_type;
+
+ function_type::swap( static_cast<function_type &>(_f) );
+ swap_impl<base_type>(_f, this);
+ }
+
+ template<typename Base>
+ void swap_impl(this_type &,
                    detail::final_overload_base const* )
     {
- //std::cout << "final" << std::endl;
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // function clear_all__impl
+ // function clear_all_impl
 
     template< typename Base >
     void clear_all_impl(Base const* )
@@ -336,10 +599,10 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // function empty_all__impl
+ // function empty_all_impl
 
     template< typename Base >
- bool empty_all_impl(Base const* )
+ bool empty_all_impl(Base const* ) const
     {
         typedef typename Base::base_type base_type;
         typedef typename Base::signature_type signature_type;
@@ -348,16 +611,78 @@
     }
 
     template<typename Base>
- bool empty_all_impl(detail::final_overload_base const*)
+ bool empty_all_impl(detail::final_overload_base const* ) const
     {
         return true;
     }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // function empty_any_impl
+
+ template< typename Base >
+ bool empty_any_impl(Base const* ) const
+ {
+ typedef typename Base::base_type base_type;
+ typedef typename Base::signature_type signature_type;
+
+ return ( empty<signature_type>() || empty_any_impl<base_type>(this) );
+ }
+
+ template<typename Base>
+ bool empty_any_impl(detail::final_overload_base const* ) const
+ {
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // function contains_impl
+
+ template< typename Base, typename Functor >
+ bool contains_impl( Base const*, const Functor & f ) const
+ {
+ typedef typename this_type::base_type base_type;
+ typedef typename Base::signature_type signature_type;
+ typedef typename wrapped_function<signature_type>::type function_type;
+
+ if ( function_type::contains( f ) )
+ return true;
+ return contains_compatible_impl<base_type, Functor>(this, f);
+ }
+
+ template< typename Base, typename Functor >
+ bool contains_impl( detail::final_overload_base const*,
+ const Functor & f ) const
+ {
+ typedef typename this_type::base_type base_type;
+ return contains_compatible_impl<base_type, Functor>(this, f);
+ }
+
+ template< typename Base, typename Functor >
+ bool contains_compatible_impl( Base const*, const Functor & f ) const
+ {
+ typedef typename Base::base_type base_type;
+ typedef typename Base::signature_type signature_type;
+ typedef typename wrapped_function<signature_type>::type function_type;
+
+ return ( function_type::contains( f )
+ || contains_impl<base_type, Functor>(this, f) );
+ }
+
+ template< typename Base, typename Functor >
+ bool containscompatible__impl( detail::final_overload_base const*,
+ const Functor & ) const
+ {
+ return false;
+ }
+
     ///////////////////////////////////////////////////////////////////////////
     // return a pointer to this object casted to the correct base pointer
     // for a generic functor
 
     template< typename F >
- boost::function<typename detail::signature_by_functor<F, this_type>::type>*
+ typename wrapped_function<
+ typename detail::signature_by_functor<F, this_type>::type
+ >::type*
     base_ptr( F const& )
     {
         return this;
@@ -369,13 +694,217 @@
 template< BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig) >
 const unsigned int
 overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>::extent
- = overloads::extent<
+ = detail::extent<
           overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
>::value;
 
+///////////////////////////////////////////////////////////////////////////////
+// swap two boost::overloads
+template<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+void swap( overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>& f1,
+ overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>& f2 )
+{
+ f1.swap(f2);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// metafunctions for call wrapper type traits
+//
+// - extent<CallWrapperType>::value
+// it provides the amount of signatures supported by a call wrapper type
+//
+// - signature<CallWrapperType, N = 0>::type
+// it provides the N-th signature for a call wrapper type
+// (indexing start from zero)
+//
+// - function<CallWrapperType, N = 0>::type
+// it provides the type of the N-th wrapped function embedded object
+// (indexing start from zero)
+//
+// - index_of_signature<CallWrapperType, Signature>::value
+// it provides the index of a signature, and returns -1 if it's not found
+//
+// - has_signature<CallWrapperType, Signature>::value
+// utility to discover if a given signature is supported by a call wrapper type
+//
+// - have_any_shared_signature<CallWrapperType, Functor>::value
+// utility to discover if a given functor has a signature supported by
+// a call wrapper type
+//
+
+///////////////////////////////////////////////////////////////////////////////
+// - extent<CallWrapperType>::value
+// it provides the amount of signatures supported by the call wrapper type
+
+template<typename CallWrapperType>
+struct extent
+{
+};
+
+template<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+struct extent< overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)> >
+{
+ private:
+ typedef overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+ overload_type;
+ public:
+ BOOST_STATIC_CONSTANT( int, value = (detail::extent<overload_type>::value) );
+};
+
+template<typename Signature>
+struct extent< boost::function<Signature> >
+{
+ BOOST_STATIC_CONSTANT( int, value = 1 );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// - signature<CallWrapperType, N = 0>::type
+// it provides the N-th signature for a call wrapper type
+// (indexing start from zero)
+
+template<typename CallWrapperType, unsigned int N = 0>
+struct signature
+{
+};
+
+template<unsigned int N, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+struct signature< overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>, N >
+{
+ private:
+ typedef overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+ overload_type;
+ public:
+ typedef typename detail::signature<N, overload_type>::type type;
+};
+
+template<typename Signature>
+struct signature< boost::function<Signature>, 0 >
+{
+ typedef Signature type;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// - function<CallWrapperType, N = 0>::type
+// it provides the type of the N-th boost::function embedded object
+// (indexing start from zero)
+
+template<typename CallWrapperType, unsigned int N = 0>
+struct function
+{
+};
+
+template<unsigned int N, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+struct function< overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>, N >
+{
+ private:
+ typedef overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+ overload_type;
+ public:
+ typedef typename detail::function<N, overload_type>::type type;
+};
+
+template<typename Signature>
+struct function< boost::function<Signature>, 0 >
+{
+ typedef boost::function<Signature> type;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// - index_of_signature<CallWrapperType, Signature>::value
+// it provides the index of a signature, and returns -1 if it's not found
+
+template<typename CallWrapperType, typename Signature>
+struct index_of_signature
+{
+};
+
+template<typename Signature, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+struct index_of_signature< overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>, Signature >
+{
+ private:
+ typedef overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+ overload_type;
+ public:
+ BOOST_STATIC_CONSTANT( int, value =
+ (static_cast<int>(detail::index_of_signature<Signature, overload_type>::value)) );
+};
+
+template<typename FuncSignature, typename Signature>
+struct index_of_signature< boost::function<FuncSignature>, Signature >
+{
+ BOOST_STATIC_CONSTANT(int, value = -1);
+};
+
+template<typename Signature>
+struct index_of_signature< boost::function<Signature>, Signature >
+{
+ BOOST_STATIC_CONSTANT(int, value = 0);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// - has_signature<CallWrapperType, Signature>::value
+// utility to discover if a given signature is supported by a call wrapper type
+
+template<typename CallWrapperType, typename Signature>
+struct has_signature
+{
+};
+
+template<typename Signature, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+struct has_signature< overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>, Signature >
+{
+ private:
+ typedef overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+ overload_type;
+ public:
+ BOOST_STATIC_CONSTANT( bool, value =
+ (detail::has_signature<Signature, overload_type>::value) );
+};
+
+template<typename FuncSignature, typename Signature>
+struct has_signature< boost::function<FuncSignature>, Signature >
+{
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+template<typename Signature>
+struct has_signature< boost::function<Signature>, Signature >
+{
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// - have_any_shared_signature<CallWrapperType, Functor>::value
+// utility to discover if a given functor has a signature supported by
+// a call wrapper type
+
+template<typename CallWrapperType, typename Functor>
+struct have_any_shared_signature
+{
+};
+
+template<typename Functor, BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, typename Sig)>
+struct have_any_shared_signature< overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>, Functor >
+{
+ private:
+ typedef overload<BOOST_PP_ENUM_PARAMS(BOOST_OVERLOAD_LIMIT, Sig)>
+ overload_type;
+ public:
+ BOOST_STATIC_CONSTANT( bool, value =
+ (detail::have_any_shared_signature<Functor, overload_type>::value) );
+};
+
+template<typename Signature, typename Functor>
+struct have_any_shared_signature< boost::function<Signature>, Functor >
+{
+ BOOST_STATIC_CONSTANT( bool, value =
+ (detail::functor_has_signature<Functor, Signature>::value) );
+};
+
 } // end overloads namespace
 
 using overloads::overload;
+using overloads::swap;
 
 } // end boost namespace
 

Modified: sandbox/overload/trunk/libs/overload/docs/Jamfile.v2
==============================================================================
--- sandbox/overload/trunk/libs/overload/docs/Jamfile.v2 (original)
+++ sandbox/overload/trunk/libs/overload/docs/Jamfile.v2 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,20 +1,69 @@
+# Boost.Overload library documentation Jamfile
+#
+# Copyright Marco Cecchetti 2007-2012. Use, modification and
+# distribution is subject to the Boost Software License, Version
+# 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+
+
 project overload/docs ;
 
-import boostbook : boostbook ;
+#import boostbook : boostbook ;
+
+import modules ;
 
 using quickbook ;
 
-xml overload : overload.qbk ;
+
+xml overload
+ :
+ qbk/overload.qbk
+ :
+ <dependency>qbk/getting_started.qbk
+ <dependency>qbk/tutorial.qbk
+ <dependency>qbk/use_cases.qbk
+ <dependency>qbk/advanced_features.qbk
+ <dependency>qbk/design_and_definitions.qbk
+ <dependency>qbk/references.qbk
+ ;
+
 
 boostbook standalone
     :
         overload
     :
- <xsl:param>boost.image.src=images/dispatcher.png
- <xsl:param>boost.image.alt="Boost.Overload"
- <xsl:param>generate.section.toc.level=3
- <xsl:param>chunk.section.depth=2
+ <xsl:param>boost.root="../../../.."
+ #<xsl:param>boost.image.src=images/dispatcher.png
+ #<xsl:param>boost.image.alt="Boost.Overload"
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=1
+ # Don't put the first section on the same page as the TOC:
         <xsl:param>chunk.first.sections=1
- <xsl:param>nav.layout=none
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=4
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=10
+
+ <dependency>css
+ <dependency>images
     ;
 
+
+if ! $(BOOST_ROOT)
+{
+ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
+}
+
+install css : [ glob $(BOOST_ROOT)/doc/src/*.css ]
+ : <location>html ;
+install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ]
+ : <location>html/images ;
+
+explicit css ;
+explicit images ;
+

Modified: sandbox/overload/trunk/libs/overload/docs/README_FIRST.txt
==============================================================================
--- sandbox/overload/trunk/libs/overload/docs/README_FIRST.txt (original)
+++ sandbox/overload/trunk/libs/overload/docs/README_FIRST.txt 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -1,8 +1,8 @@
 
-BOOST OVERLOAD (updated 2007/10/28)
+BOOST OVERLOAD (updated 2012/02/18)
 
 =================================================================
-Copyright (c) 2007 Marco Cecchetti
+Copyright (c) 2007-2012 Marco Cecchetti
 
 Use, modification and distribution of this library is
 subject to the Boost Software License, Version 1.0.
@@ -32,16 +32,72 @@
 
 Library Documentation
 =====================
-http://docs.google.com/View?docid=dhd386mp_16gxsfxn
 
-Library Tutorial
+
+
+*****************
+* version 0.4.0 *
+*****************
+
+tested with boost version: 1.34.1, 1.48.0
+
+Compiler support
 ================
-http://docs.google.com/Doc?id=dfxvjncs_1x6456m
+
+Under Linux the library has been tested with the following compilers:
+
+- gcc 3.4.2, 4.1.2, 4.2.2, 4.5.1, 4.7
+- intel 9.1*, 10.0*, 11.0*, 12.1
+
+Under Windows the library has been tested with the following compilers:
+
+- mingw 3.4.2, 4.4.0, 4.4.7, 4.5.4, 4.6.1, 4.7
+- msvc 7.1**, 8.0, 9.0, 10.0
+
+
+* all test passed but Boost.Lambda result type deduction support
+
+** all test passed but Boost.Lambda result type deduction support and signature
+deduction of multi-signature function objects, for the latter a workaround is
+to use the signature based syntax with them;
+
+
+What's new
+===========
+- now there is an ad-hoc method for setting up multiple object targets from
+ a polymorphic function object (set_for_each_shared_signature);
+
+- the set<Signature> method can now handle the case of a functor whose
+ call signature is only "compatible" but not equal to Signature;
+
+- added 3 new helper methods:
+ - the empty_any method that tell us if any object targets are empty;
+ - the_empty_none method that returns true if no object target is empty;
+ - the swap method that accepts overload objects of the same type of (*this);
+ its action is to exchange the object targets for each pair of embedded
+ boost::function objects with the same call signature
+
+- added support for Boost.ResultOf and Boost Lambda result type deduction
+
+- added 2 utility function:
+ - swap(f1, f2) that is equivalent to f1.swap(f2)
+ - make_overload create an overload object from a set of monomorphic functor
+ (requires Boost.TypeOf)
+
+- boost::overload itself can be passed as a functor
+
+- rewritten and improved documentation
+
+- now, more tests are performed
+
+- rewritten and added a lot of examples
+
+- refactored some metafunction names
 
 
-**************************************
-* version 0.3.0 (overload-0.3.0.zip) *
-**************************************
+******************
+* version 0.3.0 *
+******************
 
 tested with boost version: 1.33.1, 1.34.1
 
@@ -83,9 +139,9 @@
 - fixed some minor issue.
 
 
-**************************************
-* version 0.2.2 (overload-0.2.2.zip) *
-**************************************
+******************
+* version 0.2.2 *
+******************
 
 tested with boost version: 1.33.1, 1.34.1
 
@@ -140,9 +196,9 @@
     signatures included in the intersection.
 
 
-**********************************
-* version 0.1 (overload-0.1.zip) *
-**********************************
+***************
+* version 0.1 *
+***************
 
 tested on gcc 4.1.2 under Linux
 

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/acknowledgements.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/acknowledgements.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Acknowledgements</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="references.html" title="References">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="references.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.acknowledgements"></a><a class="link" href="acknowledgements.html" title="Acknowledgements">Acknowledgements</a>
+</h2></div></div></div>
+<p>
+ Thanks go to Joel De Guzman for posting an implementation of a minimal overload
+ implementation to the Boost C++ Developer Mailing List, and to Douglas Gregor
+ for Boost.Function -- without which all this would not have been possible.
+ I especially thank Dean Michael Berris that contributed to prepare some parts
+ of this documentation.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="references.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/advanced_features.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/advanced_features.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,674 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Advanced features</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="use_case.html" title="Use case">
+<link rel="next" href="design_and_definitions.html" title="Design and Definitions">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_case.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="design_and_definitions.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.advanced_features"></a><a class="link" href="advanced_features.html" title="Advanced features">Advanced features</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method">The
+ set_for_each_shared_signature method</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___polymorphic_function_objects">Example
+ - Polymorphic function objects</a></span></dt>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___a_statefull_polymorphic_function_object">Example
+ - A statefull polymorphic function object</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support">Boost.ResultOf
+ and Boost.Lambda support</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_resultof_support">Example
+ - Boost.ResultOf support</a></span></dt>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_lambda_support">Example
+ - Boost.Lambda support</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.a_special_variant_of_the_set_signature__method">A
+ special variant of the set&lt;Signature&gt; method</a></span></dt>
+<dt><span class="section">Type Traits</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.advanced_features.the_set_for_each_shared_signature_method"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method" title="The set_for_each_shared_signature method">The
+ set_for_each_shared_signature method</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___polymorphic_function_objects">Example
+ - Polymorphic function objects</a></span></dt>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___a_statefull_polymorphic_function_object">Example
+ - A statefull polymorphic function object</a></span></dt>
+</dl></div>
+<p>
+ The <a class="link" href="references.html#ref_overload_set_for_each_shared_sig"><code class="computeroutput"><span class="identifier">set_for_each_shared_signature</span></code></a>
+ method can manage multi-signature function objects of class type (i.e. function
+ objects whose <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code>
+ is overloaded or is a template function) and it handles them in a special
+ way. The passed function object sets/replaces all the existent object targets
+ related to the call signatures supported by both the given instantiation
+ of the template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> and the passed function
+ object itself.
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Signature deduction of multi-signature function objects is not supported
+ with Microsoft Visual C++ 7.1, you have to use the <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a>
+ method.
+ </p></td></tr>
+</table></div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ The <a class="link" href="references.html#ref_overload_set_for_each_shared_sig"><code class="computeroutput"><span class="identifier">set_for_each_shared_signature</span></code></a>
+ method cannot handle either free or member polymorphic functions.
+ </p></td></tr>
+</table></div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___polymorphic_function_objects"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___polymorphic_function_objects" title="Example - Polymorphic function objects">Example
+ - Polymorphic function objects</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">/* polymorphic function object */</span>
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">);</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// function object</span>
+ <span class="identifier">bar</span> <span class="identifier">foo</span><span class="special">;</span>
+
+ <span class="comment">// we use the set_for_each_shared_signature method</span>
+ <span class="comment">// for setting a copy of foo as object target for</span>
+ <span class="comment">// both the shared int(int ) and int(char ) call signatures</span>
+ <span class="comment">// *warning*: internally two separate boost::functions</span>
+ <span class="comment">// are created</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set_for_each_shared_signature</span><span class="special">(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="comment">// invokes int foo(int ) template instantiation</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="comment">// invokes int foo(char ) template instantiation</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="comment">// through the empty&lt;Signature&gt;() method we check</span>
+ <span class="comment">// that object target related to the not shared</span>
+ <span class="comment">// int(int, int ) call signature is still empty</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ It is important that you understand that internally for each supported
+ signature a new <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code> object is generated exactly
+ as you had used the <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a>
+ method. Each created <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
+ instance wraps a different copy of the passed multi-signature function
+ object. This behaviour can lead to unexpected result if the multi-signature
+ function object has its own state. A solution to this issue is to to utilize
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span></code> for wrapping the function object.
+ </p></td></tr>
+</table></div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___a_statefull_polymorphic_function_object"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method.example___a_statefull_polymorphic_function_object" title="Example - A statefull polymorphic function object">Example
+ - A statefull polymorphic function object</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">/* polymorphic function object */</span>
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="identifier">bar</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">total_calls</span><span class="special">(</span><span class="number">0</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="special">++</span><span class="identifier">total_calls</span><span class="special">;</span> <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="special">++</span><span class="identifier">total_calls</span><span class="special">;</span> <span class="keyword">return</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">);</span> <span class="special">}</span>
+
+ <span class="keyword">int</span> <span class="identifier">total_calls</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// function object</span>
+ <span class="identifier">bar</span> <span class="identifier">foo</span><span class="special">;</span>
+ <span class="identifier">foo</span><span class="special">(</span> <span class="number">1</span> <span class="special">);</span> <span class="identifier">foo</span><span class="special">(</span> <span class="char">'x'</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo</span><span class="special">.</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set_for_each_shared_signature</span><span class="special">(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo</span><span class="special">.</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span> <span class="comment">// not 4</span>
+ <span class="comment">// f.get&lt;int (int )&gt;() and f.get&lt;double (double )&gt;() are</span>
+ <span class="comment">// different boost::function instances that own two</span>
+ <span class="comment">// different copy of the foo function object</span>
+ <span class="keyword">const</span> <span class="identifier">bar</span><span class="special">*</span> <span class="identifier">foo_copy_1</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;().</span><span class="identifier">target</span><span class="special">&lt;</span><span class="identifier">bar</span><span class="special">&gt;();</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo_copy_1</span><span class="special">-&gt;</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">3</span> <span class="special">);</span> <span class="comment">// not 4</span>
+ <span class="keyword">const</span> <span class="identifier">bar</span><span class="special">*</span> <span class="identifier">foo_copy_2</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)&gt;().</span><span class="identifier">target</span><span class="special">&lt;</span><span class="identifier">bar</span><span class="special">&gt;();</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo_copy_2</span><span class="special">-&gt;</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">3</span> <span class="special">);</span> <span class="comment">// not 4</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">clear_all</span><span class="special">();</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="comment">// foo.total_calls is still equal to 2</span>
+
+ <span class="comment">//</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set_for_each_shared_signature</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">foo</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">);</span>
+ <span class="comment">// f.get&lt;int (int )&gt;() and f.get&lt;double (double )&gt;()</span>
+ <span class="comment">// are different boost::function instances</span>
+ <span class="comment">// that own a reference to the same function object</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo</span><span class="special">.</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">4</span> <span class="special">);</span>
+ <span class="keyword">const</span> <span class="identifier">bar</span><span class="special">*</span> <span class="identifier">foo_ref_1</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;().</span><span class="identifier">target</span><span class="special">&lt;</span><span class="identifier">bar</span><span class="special">&gt;();</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo_ref_1</span><span class="special">-&gt;</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">4</span> <span class="special">);</span>
+ <span class="keyword">const</span> <span class="identifier">bar</span><span class="special">*</span> <span class="identifier">foo_ref_2</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)&gt;().</span><span class="identifier">target</span><span class="special">&lt;</span><span class="identifier">bar</span><span class="special">&gt;();</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">foo_ref_2</span><span class="special">-&gt;</span><span class="identifier">total_calls</span> <span class="special">==</span> <span class="number">4</span> <span class="special">);</span>
+
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.advanced_features.boost_resultof_and_boost_lambda_support"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support" title="Boost.ResultOf and Boost.Lambda support">Boost.ResultOf
+ and Boost.Lambda support</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_resultof_support">Example
+ - Boost.ResultOf support</a></span></dt>
+<dt><span class="section"><a href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_lambda_support">Example
+ - Boost.Lambda support</a></span></dt>
+</dl></div>
+<p>
+ <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a> provides support for
+ Boost.ResultOf
+ and Boost.Lambda
+ result type deduction. The latter needs to be explicitly enabled by defines
+ the macro <code class="computeroutput"><span class="identifier">BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT</span></code>.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_resultof_support"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_resultof_support" title="Example - Boost.ResultOf support">Example
+ - Boost.ResultOf support</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">static_assert</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">is_same</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">result_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">;</span>
+
+<span class="keyword">struct</span> <span class="identifier">A</span> <span class="special">{};</span>
+<span class="keyword">struct</span> <span class="identifier">B</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">A</span> <span class="special">{};</span>
+
+
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">char</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">),</span> <span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">),</span> <span class="identifier">A</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">A</span><span class="special">&amp;</span> <span class="special">)&gt;</span>
+ <span class="identifier">overload_type</span><span class="special">;</span>
+
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">int</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">char</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">double</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="keyword">short</span> <span class="keyword">int</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">int</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="keyword">char</span><span class="special">&amp;</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">char</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">float</span><span class="special">&amp;</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">double</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="identifier">B</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="identifier">A</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span> <span class="identifier">overload_type</span> <span class="special">(</span><span class="identifier">B</span><span class="special">&amp;</span> <span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="identifier">A</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_lambda_support"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support.example___boost_lambda_support" title="Example - Boost.Lambda support">Example
+ - Boost.Lambda support</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">// You need to explicitly enable Boost.Lambda support</span>
+<span class="preprocessor">#define</span> <span class="identifier">BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="keyword">int</span> <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+<span class="keyword">int</span> <span class="identifier">bar</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span> <span class="special">}</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">;</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">bar</span><span class="special">);</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">hello</span><span class="special">(</span><span class="string">"hello"</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">10</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">hello</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">f</span><span class="special">(</span><span class="number">10</span><span class="special">,</span> <span class="identifier">hello</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">10</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="number">5</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">f</span><span class="special">(</span><span class="number">10</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">hello</span><span class="special">)(</span><span class="number">10</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">f</span><span class="special">(</span><span class="number">10</span><span class="special">,</span> <span class="identifier">hello</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Boost.Lambda
+ result type deduction support does not work with MSVC 7.1 and with all
+ Intel compilers prior to version 12.0
+ </p></td></tr>
+</table></div>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.advanced_features.a_special_variant_of_the_set_signature__method"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.a_special_variant_of_the_set_signature__method" title="A special variant of the set&lt;Signature&gt; method">A
+ special variant of the set&lt;Signature&gt; method</a>
+</h3></div></div></div>
+<p>
+ When the explicit call signature of a member function supported by an overload
+ object is the non-const qualified version (e.g. as <code class="computeroutput"><span class="keyword">int</span>
+ <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">)</span></code>
+ where <code class="computeroutput"><span class="identifier">bar</span></code> is of class type),
+ you need a special variant of the call signature based syntax in order to
+ manage the case of a class with two member function overloads that differ
+ for the const qualifier only. This is exactly what happens in the next example:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">mf</span><span class="special">(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">int</span> <span class="identifier">mf</span><span class="special">(</span><span class="keyword">int</span> <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">int</span> <span class="identifier">mf</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">3</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="comment">// overload object that supports the *non-const* qualified</span>
+ <span class="comment">// explicit call signature int (bar*, int )</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">double</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// bar instance</span>
+ <span class="identifier">bar</span> <span class="identifier">foo</span><span class="special">;</span>
+
+ <span class="comment">// we set bar::*mf as object target</span>
+ <span class="comment">// for the int (bar*, double ) call signature only</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">double</span> <span class="special">)&gt;(&amp;</span><span class="identifier">bar</span><span class="special">::</span><span class="identifier">mf</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="number">3</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// if you try to compile the following line of code:</span>
+ <span class="comment">// f.set&lt;int (bar*, int )&gt;(&amp;bar::mf);</span>
+ <span class="comment">// you get a compiler error, because the call signature</span>
+ <span class="comment">// syntax is not able to disambiguate between two member</span>
+ <span class="comment">// functions that differ for the const qualifier only</span>
+
+
+ <span class="comment">// in order to set a pointer to the non-const qualified</span>
+ <span class="comment">// version of bar::mf as object target</span>
+ <span class="comment">// for the int (bar*, int ) call signature of the overload</span>
+ <span class="comment">// object f, you can utilize a special variant of</span>
+ <span class="comment">// the call signature syntax</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloads</span><span class="special">::</span><span class="identifier">non_const</span><span class="special">;</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">),</span> <span class="identifier">non_const</span><span class="special">&gt;(&amp;</span><span class="identifier">bar</span><span class="special">::</span><span class="identifier">mf</span><span class="special">);</span>
+ <span class="comment">// now foo.mf(int ) is invoked</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+
+ <span class="comment">// what if I want to set a pointer to</span>
+ <span class="comment">// the const qualified version of boost::mf as object</span>
+ <span class="comment">// target for the int (bar*, int ) call signature of</span>
+ <span class="comment">// the overload object f ?</span>
+
+ <span class="comment">// first off, you should notice that the set up of such</span>
+ <span class="comment">// a target is semantically correct because the explicit</span>
+ <span class="comment">// call signature of the const qualified bar::mf function</span>
+ <span class="comment">// member is int (const bar*, int ) and we can always pass</span>
+ <span class="comment">// a T* argument where a const T* is expected.</span>
+
+ <span class="comment">// as above you can utilize the special variant of the call</span>
+ <span class="comment">// signature syntax</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloads</span><span class="special">::</span><span class="identifier">const_</span><span class="special">;</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">),</span> <span class="identifier">const_</span><span class="special">&gt;(&amp;</span><span class="identifier">bar</span><span class="special">::</span><span class="identifier">mf</span><span class="special">);</span>
+ <span class="comment">// now foo.mf(int ) const is invoked</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span>
+
+
+
+ <span class="comment">// you should notice that in case we have an overload</span>
+ <span class="comment">// object that supports the *const* qualified explicit call</span>
+ <span class="comment">// signature int (const bar*, int )</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">),</span>
+ <span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">)&gt;</span> <span class="identifier">g</span><span class="special">;</span>
+ <span class="comment">// we can utilize the standard call signature based syntax</span>
+ <span class="comment">// because selecting the const qualified version of the</span>
+ <span class="comment">// bar::mf member function is the only semantically correct</span>
+ <span class="comment">// choice</span>
+
+ <span class="comment">// no compiler error here!</span>
+ <span class="identifier">g</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">)&gt;(&amp;</span><span class="identifier">bar</span><span class="special">::</span><span class="identifier">mf</span><span class="special">);</span>
+ <span class="comment">// foo.mf(int ) const is invoked</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">g</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span>
+
+ <span class="comment">// and if you try to compile the following line of code:</span>
+ <span class="comment">// g.set&lt;int (const bar*, int ), non_const&gt;(&amp;bar::mf);</span>
+ <span class="comment">// you get a compiler error because you cannot pass a</span>
+ <span class="comment">// const T* argument where a T* is expected</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.advanced_features.type_traits"></a><a class="link" href="advanced_features.html#boost_overload.advanced_features.type_traits" title="Type Traits">Type Traits</a>
+</h3></div></div></div>
+<p>
+ For extracting type traits from a template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> the following metafunctions
+ are provided:
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Metafunction
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><a class="link" href="references.html#ref_tt_extent">extent</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ it provides the amount of signatures supported by a call wrapper
+ type
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><a class="link" href="references.html#ref_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">N</span>
+ <span class="special">=</span> <span class="number">0</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ it provides the N-th signature for a call wrapper type (indexing
+ start from zero)
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><a class="link" href="references.html#ref_tt_function">function</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span>
+ <span class="identifier">N</span> <span class="special">=</span>
+ <span class="number">0</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ it provides the type of the N-th boost::function embedded object
+ (indexing start from zero)
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><a class="link" href="references.html#ref_tt_index_of_sig">index_of_signature</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ it provides the index of a signature, and returns -1 if it is not
+ found
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><a class="link" href="references.html#ref_tt_has_signature">has_signature</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ utility to discover if a given signature is supported by a call
+ wrapper type
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><a class="link" href="references.html#ref_tt_have_any_shared_sig">have_any_shared_signature</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">Functor</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ utility to discover if a given functor has a signature supported
+ by a call wrapper type
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+ These metafunctions live in the namespace <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloads</span></code>
+ and work with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code> too.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">static_assert</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">is_same</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloads</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">;</span>
+
+
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="keyword">long</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="special">(*</span><span class="identifier">foo_ptr</span><span class="special">)(</span><span class="keyword">long</span> <span class="special">);</span>
+
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+
+
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;</span>
+ <span class="identifier">overload_type</span><span class="special">;</span>
+
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">extent</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">3</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)&gt;</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloads</span><span class="special">::</span><span class="identifier">index_of_signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">2</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloads</span><span class="special">::</span><span class="identifier">index_of_signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">float</span> <span class="special">)&gt;::</span><span class="identifier">value</span> <span class="special">==</span> <span class="special">-</span><span class="number">1</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">has_signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="keyword">int</span><span class="special">(</span> <span class="keyword">char</span><span class="special">)&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="special">!</span><span class="identifier">has_signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="keyword">int</span><span class="special">(</span> <span class="keyword">long</span><span class="special">)&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">have_any_shared_signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="identifier">bar</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="special">!</span><span class="identifier">have_any_shared_signature</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="identifier">foo_ptr</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+
+
+
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">)&gt;</span> <span class="identifier">function_type</span><span class="special">;</span>
+
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">extent</span><span class="special">&lt;</span><span class="identifier">function_type</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span>
+ <span class="identifier">is_same</span><span class="special">&lt;</span>
+ <span class="identifier">signature</span><span class="special">&lt;</span><span class="identifier">function_type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)</span>
+ <span class="special">&gt;::</span><span class="identifier">value</span>
+<span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">has_signature</span><span class="special">&lt;</span><span class="identifier">function_type</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="special">!</span><span class="identifier">has_signature</span><span class="special">&lt;</span><span class="identifier">function_type</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="identifier">have_any_shared_signature</span><span class="special">&lt;</span><span class="identifier">function_type</span><span class="special">,</span> <span class="identifier">bar</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span> <span class="special">!</span><span class="identifier">have_any_shared_signature</span><span class="special">&lt;</span><span class="identifier">function_type</span><span class="special">,</span> <span class="identifier">foo_ptr</span><span class="special">&gt;::</span><span class="identifier">value</span> <span class="special">));</span>
+</pre>
+<p>
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_case.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="design_and_definitions.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/design_and_definitions.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/design_and_definitions.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,295 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Design and Definitions</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="advanced_features.html" title="Advanced features">
+<link rel="next" href="references.html" title="References">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="advanced_features.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="references.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.design_and_definitions"></a><a class="link" href="design_and_definitions.html" title="Design and Definitions">Design and Definitions</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Design</span></dt>
+<dt><span class="section">Definitions</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.invoke_expression">INVOKE
+ expression</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.function_objects">Function
+ Objects</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects">Call
+ Signatures and Callable Objects</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_wrappers">Call
+ Wrappers</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.dynamic_function_wrapper">Dynamic
+ Function Wrapper</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.dynamic_overloaded_function_wrapper">Dynamic
+ Overloaded Function Wrapper</a></span></dt>
+</dl></dd>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.design_and_definitions.design"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.design" title="Design">Design</a>
+</h3></div></div></div>
+<p>
+ The library is succinctly implemented in one header file requiring only that
+ Boost.Function,
+ and a small subset of Boost.TypeTraits
+ are available. This library also requires the Boost.Preprocessor
+ library if in case you don't want to get the preprocessed header file. The
+ library is configured by default to handle overloads with 10 unique signatures
+ and can be configured to support more by changing the <code class="computeroutput"><span class="identifier">BOOST_OVERLOAD_LIMIT</span></code>
+ macro when building the application that uses <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.design_and_definitions.definitions"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions" title="Definitions">Definitions</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.invoke_expression">INVOKE
+ expression</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.function_objects">Function
+ Objects</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects">Call
+ Signatures and Callable Objects</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_wrappers">Call
+ Wrappers</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.dynamic_function_wrapper">Dynamic
+ Function Wrapper</a></span></dt>
+<dt><span class="section"><a href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.dynamic_overloaded_function_wrapper">Dynamic
+ Overloaded Function Wrapper</a></span></dt>
+</dl></div>
+<p>
+ In accordance with the C++11
+ ISO standard, we provide the following definitions.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.design_and_definitions.definitions.invoke_expression"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.invoke_expression" title="INVOKE expression">INVOKE
+ expression</a>
+</h4></div></div></div>
+<p>
+ De&#64257;ne <code class="computeroutput"><span class="identifier">INVOKE</span> <span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">t1</span><span class="special">,</span> <span class="identifier">t2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">tN</span><span class="special">)</span></code> as
+ follows:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">t1</span><span class="special">.*</span><span class="identifier">f</span><span class="special">)(</span><span class="identifier">t2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">tN</span><span class="special">)</span></code>
+ when <code class="computeroutput"><span class="identifier">f</span></code> is a pointer
+ to a member function of a class <code class="computeroutput"><span class="identifier">T</span></code>
+ and <code class="computeroutput"><span class="identifier">t1</span></code> is an object
+ of type <code class="computeroutput"><span class="identifier">T</span></code> or a reference
+ to an object of type <code class="computeroutput"><span class="identifier">T</span></code>
+ or a reference to an object of a type derived from <code class="computeroutput"><span class="identifier">T</span></code>;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">((*</span><span class="identifier">t1</span><span class="special">).*</span><span class="identifier">f</span><span class="special">)(</span><span class="identifier">t2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">tN</span><span class="special">)</span></code>
+ when <code class="computeroutput"><span class="identifier">f</span></code> is a pointer
+ to a member function of a class <code class="computeroutput"><span class="identifier">T</span></code>
+ and <code class="computeroutput"><span class="identifier">t1</span></code> is not one of
+ the types described in the previous item;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">t1</span><span class="special">.*</span><span class="identifier">f</span></code> when <code class="computeroutput"><span class="identifier">N</span>
+ <span class="special">==</span> <span class="number">1</span></code>
+ and <code class="computeroutput"><span class="identifier">f</span></code> is a pointer
+ to member data of a class <code class="computeroutput"><span class="identifier">T</span></code>
+ and <code class="computeroutput"><span class="identifier">t1</span></code> is an object
+ of type <code class="computeroutput"><span class="identifier">T</span></code> or a reference
+ to an object of type <code class="computeroutput"><span class="identifier">T</span></code>
+ or a reference to an object of a type derived from <code class="computeroutput"><span class="identifier">T</span></code>;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(*</span><span class="identifier">t1</span><span class="special">).*</span><span class="identifier">f</span></code>
+ when <code class="computeroutput"><span class="identifier">N</span> <span class="special">==</span>
+ <span class="number">1</span></code> and <code class="computeroutput"><span class="identifier">f</span></code>
+ is a pointer to member data of a class <code class="computeroutput"><span class="identifier">T</span></code>
+ and <code class="computeroutput"><span class="identifier">t1</span></code> is not one of
+ the types described in the previous item;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">t1</span><span class="special">,</span> <span class="identifier">t2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">tN</span><span class="special">)</span></code> in all other cases.
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.design_and_definitions.definitions.function_objects"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.function_objects" title="Function Objects">Function
+ Objects</a>
+</h4></div></div></div>
+<p>
+ A <span class="emphasis"><em>function object type</em></span> is an object type that can
+ be the type of the expression preceding the parenthesis in a function call.
+ A <span class="emphasis"><em>function object</em></span> is an object of function object
+ type. A function object type that is also of class type must expose a public
+ function call operator.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">Call
+ Signatures and Callable Objects</a>
+</h4></div></div></div>
+<p>
+ A <span class="emphasis"><em>call signature</em></span> is the name of the expression <code class="computeroutput"><span class="identifier">R</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span><span class="identifier">A2</span><span class="special">,...,</span><span class="identifier">AN</span><span class="special">)</span></code> where
+ <code class="computeroutput"><span class="identifier">R</span><span class="special">,</span>
+ <span class="identifier">A1</span><span class="special">,</span><span class="identifier">A2</span><span class="special">,...,</span><span class="identifier">AN</span></code> are types. Two call signatures are
+ regarded as <span class="emphasis"><em>equal</em></span> iff the ordered N-upla <code class="computeroutput"><span class="identifier">A1</span><span class="special">,</span><span class="identifier">A2</span><span class="special">,...,</span><span class="identifier">AN</span></code>
+ of one call signature match exactly the N-upla of the other one. A call
+ signature <code class="computeroutput"><span class="identifier">S1</span><span class="special">:=</span><span class="identifier">R1</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,...,</span><span class="identifier">AN</span><span class="special">)</span></code> is
+ <span class="emphasis"><em>compatible</em></span> with a call signature <code class="computeroutput"><span class="identifier">S2</span><span class="special">:=</span><span class="identifier">R2</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">,...,</span><span class="identifier">BM</span><span class="special">)</span></code> if
+ we have <code class="computeroutput"><span class="identifier">N</span> <span class="special">==</span>
+ <span class="identifier">M</span></code>, <code class="computeroutput"><span class="identifier">Bi</span></code>
+ is implicitly convertible to <code class="computeroutput"><span class="identifier">Ai</span></code>
+ for each <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span>
+ <span class="number">1</span><span class="special">,...,</span><span class="identifier">N</span></code> and <code class="computeroutput"><span class="identifier">R1</span></code>
+ is implicitly convertible to <code class="computeroutput"><span class="identifier">R2</span></code>.
+ </p>
+<p>
+ A <span class="emphasis"><em>callable type</em></span> is a function object type or a pointer
+ to member. A <span class="emphasis"><em>callable object</em></span> or <span class="emphasis"><em>functor</em></span>
+ is an object of callable type.
+ </p>
+<p>
+ A callable object <code class="computeroutput"><span class="identifier">f</span></code> supports
+ the call signature <code class="computeroutput"><span class="identifier">S</span><span class="special">:=</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span><span class="identifier">A2</span><span class="special">,...,</span><span class="identifier">AN</span><span class="special">)</span></code> if
+ the expression <code class="computeroutput"><span class="identifier">INVOKE</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,...,</span><span class="identifier">aN</span> <span class="special">)</span></code> where <code class="computeroutput"><span class="identifier">ai</span></code>
+ is of type <code class="computeroutput"><span class="identifier">Ai</span></code> is well formed
+ and can be implicitly converted to type <code class="computeroutput"><span class="identifier">R</span></code>
+ or <code class="computeroutput"><span class="identifier">R</span></code> is the <code class="computeroutput"><span class="keyword">void</span></code> type.
+ </p>
+<p>
+ In case <code class="computeroutput"><span class="identifier">f</span></code> is a pointer
+ to member function we call <code class="computeroutput"><span class="identifier">S</span></code>
+ an <span class="emphasis"><em>explicit call signature</em></span> of <code class="computeroutput"><span class="identifier">f</span></code>,
+ and we call the call signature <code class="computeroutput"><span class="identifier">R</span>
+ <span class="special">(</span><span class="identifier">A2</span><span class="special">,...,</span><span class="identifier">AN</span><span class="special">)</span></code> <span class="emphasis"><em>the implicit call signature</em></span>
+ of <code class="computeroutput"><span class="identifier">f</span></code>.
+ </p>
+<p>
+ Given a call signature <code class="computeroutput"><span class="identifier">S</span> <span class="special">:=</span> <span class="identifier">R</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span><span class="identifier">A2</span><span class="special">,...,</span><span class="identifier">AN</span><span class="special">)</span></code> with
+ <code class="computeroutput"><span class="identifier">N</span> <span class="special">&gt;=</span>
+ <span class="number">0</span></code>, the type <code class="computeroutput"><span class="identifier">Ai</span></code>
+ is said the <span class="emphasis"><em>i-th argument type</em></span> of <code class="computeroutput"><span class="identifier">S</span></code>
+ and the type <code class="computeroutput"><span class="identifier">R</span></code> is the
+ <span class="emphasis"><em>result type</em></span> of <code class="computeroutput"><span class="identifier">S</span></code>,
+ finally <code class="computeroutput"><span class="identifier">N</span></code> is the arity
+ of <code class="computeroutput"><span class="identifier">S</span></code>. If a callable object
+ supports only one call signature these naming conventions extend naturally
+ to the callable object.
+ </p>
+<p>
+ A <span class="emphasis"><em>multi-signature</em></span> or <span class="emphasis"><em>polymorphic callable
+ object</em></span> is a callable object that supports two or more different
+ call signatures. For a pointer to member function the previous definition
+ apply to the implicit signature.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.design_and_definitions.definitions.call_wrappers"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_wrappers" title="Call Wrappers">Call
+ Wrappers</a>
+</h4></div></div></div>
+<p>
+ A <span class="emphasis"><em>call wrapper type</em></span> is a type that holds a callable
+ object and supports a call operation that forwards to that object. A <span class="emphasis"><em>call
+ wrapper</em></span> is an object of call wrapper type.
+ </p>
+<p>
+ A <span class="emphasis"><em>target object</em></span> is the callable object held by a call
+ wrapper.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.design_and_definitions.definitions.dynamic_function_wrapper"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.dynamic_function_wrapper" title="Dynamic Function Wrapper">Dynamic
+ Function Wrapper</a>
+</h4></div></div></div>
+<p>
+ A type F is a model of <span class="emphasis"><em>Dynamic Function Wrapper</em></span> with
+ signature S if we have that :
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ F is a call wrapper type
+ </li>
+<li class="listitem">
+ F provides a method to set/replace the object target;
+ </li>
+<li class="listitem">
+ F provides a method to check if the object target is empty.
+ </li>
+</ul></div>
+<p>
+ The template classes <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
+ and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">function</span></code> in C++11 are families of models
+ of Dynamic Function Wrapper. Any instantiation of the template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> that supports one and
+ only one call signature is a model of Dynamic Function Wrapper.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.design_and_definitions.definitions.dynamic_overloaded_function_wrapper"></a><a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.dynamic_overloaded_function_wrapper" title="Dynamic Overloaded Function Wrapper">Dynamic
+ Overloaded Function Wrapper</a>
+</h4></div></div></div>
+<p>
+ A type <code class="computeroutput"><span class="identifier">F</span></code> is a model of
+ <span class="emphasis"><em>Dynamic Overloaded Function Wrapper</em></span> supporting the
+ signatures <code class="computeroutput"><span class="identifier">S1</span><span class="special">,</span>
+ <span class="special">...,</span> <span class="identifier">SN</span></code>
+ with N &gt;= 2 if for each integer <code class="computeroutput"><span class="identifier">i</span></code>
+ s.t. 1 &lt;= i &lt;= N we have that :
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">F</span></code> is a call wrapper
+ type for any callable object that supports at least one of the call
+ signatures supported by F; the current accessible callable object related
+ to <code class="computeroutput"><span class="identifier">Si</span></code> is named the
+ object target tied to <code class="computeroutput"><span class="identifier">Si</span></code>;
+ if there is no accessible callable object tied to <code class="computeroutput"><span class="identifier">Si</span></code>
+ the object target related to <code class="computeroutput"><span class="identifier">Si</span></code>
+ is said empty;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">F</span></code> provides a method
+ to set/replace the object target tied to <code class="computeroutput"><span class="identifier">Si</span></code>;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">F</span></code> provides a method
+ to check if the object target tied to <code class="computeroutput"><span class="identifier">Si</span></code>
+ is empty
+ </li>
+</ul></div>
+<p>
+ Any instantiation of the template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> that support more than
+ one call signature is a model of Dynamic Overloaded Function Wrapper.
+ </p>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="advanced_features.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="references.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/getting_started.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/getting_started.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,107 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Getting Started</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="next" href="tutorial.html" title="Tutorial">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.getting_started"></a><a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Overview</span></dt>
+<dt><span class="section"><a href="getting_started.html#boost_overload.getting_started.installation_and_configuration">Installation
+ and configuration</a></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.getting_started.overview"></a><a class="link" href="getting_started.html#boost_overload.getting_started.overview" title="Overview">Overview</a>
+</h3></div></div></div>
+<p>
+ Boost.Function
+ already supports wrapping function objects, member function pointers, and
+ function pointers in general. By itself, Boost.Function
+ is already powerful and already useful enough in situations where you want
+ to be able to pass around generic function objects. The only limitation of
+ Boost.Function
+ is that you can only wrap one function with one instance of the wrapper,
+ and only functions or function objects that all have the same signatures.
+ This becomes a problem in many settings where an overloaded function set
+ is required. <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a> allows
+ this functionality of supporting multiple signatures by wrapping multiple
+ Boost.Function
+ objects in a single object that overloads the function operator to support
+ the various overloads defined. This allows us to map many functions to a
+ single overload instance, provided that these functions have a call signature
+ that the <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> instance supports. To illustrate
+ the usage of the <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a> library,
+ the following code snippet is provided:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">a</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span> <span class="special">};</span>
+<span class="keyword">long</span> <span class="identifier">bar</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">;</span> <span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">long</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">)&gt;</span> <span class="identifier">functions</span><span class="special">;</span>
+ <span class="identifier">functions</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">functions</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">bar</span><span class="special">);</span>
+
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">functions</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="number">2</span><span class="special">);</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">functions</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">)</span> <span class="special">==</span> <span class="number">5L</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ In the above example we have two functions <code class="computeroutput"><span class="identifier">foo</span></code>
+ and <code class="computeroutput"><span class="identifier">bar</span></code>, both having different
+ signatures and return types. This illustrates the powerful features which
+ <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a> allows us to exploit:
+ compile-time function argument deduction and registration, and static function
+ dispatch using function overload type deduction.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.getting_started.installation_and_configuration"></a><a class="link" href="getting_started.html#boost_overload.getting_started.installation_and_configuration" title="Installation and configuration">Installation
+ and configuration</a>
+</h3></div></div></div>
+<p>
+ The library is based only on header files, all you have to do in order to
+ utilize it is to include the following header file: <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span></code> as
+ shown in the above example. Through the <code class="computeroutput"><span class="identifier">BOOST_OVERLOAD_LIMITS</span></code>
+ configuration macro you can set up the maximum number of unique signatures
+ supported by the overload template class. The default value is 10 signatures.
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/references.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/references.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,822 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>References</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="design_and_definitions.html" title="Design and Definitions">
+<link rel="next" href="acknowledgements.html" title="Acknowledgements">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="design_and_definitions.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.references"></a><a class="link" href="references.html" title="References">References</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><boost/overload.hpp></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload">Class
+ template overload</a></span></dt>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.call_wrapper_type_traits">Call
+ Wrapper Type Traits</a></span></dt>
+</dl></dd>
+<dt><span class="section"><boost/overload/make_overload.hpp></span></dt>
+<dd><dl><dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload">Generative
+ function make_overload</a></span></dt></dl></dd>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.references.boost_overload_hpp"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp" title="&lt;boost/overload.hpp&gt;">&lt;boost/overload.hpp&gt;</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload">Class
+ template overload</a></span></dt>
+<dd><dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+</dl></dd>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.call_wrapper_type_traits">Call
+ Wrapper Type Traits</a></span></dt>
+<dd><dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+</dl></dd>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload">Class
+ template overload</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.synopsis"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.synopsis" title="Synopsis">Synopsis</a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature1</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Signature2</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">no_signature</span><span class="special">,</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="keyword">typename</span> <span class="identifier">SignatureK</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">no_signature</span><span class="special">&gt;</span> <span class="comment">// K == BOOST_OVERLOAD_LIMITS</span>
+<span class="keyword">class</span> <span class="identifier">overload</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">overload_base</span><span class="special">&lt;</span><span class="number">0</span><span class="special">,</span> <span class="identifier">Signature1</span><span class="special">,</span> <span class="identifier">Signature2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">SignatureK</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// types</span>
+ <span class="keyword">typedef</span> <span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">Signature1</span><span class="special">,</span> <span class="identifier">Signature2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">SignatureK</span><span class="special">&gt;</span> <span class="identifier">this_type</span><span class="special">;</span> <a name="ref_overload_this_type"></a>
+ <span class="keyword">typedef</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">overload_base</span><span class="special">&lt;</span><span class="number">0</span><span class="special">,</span> <span class="identifier">Signature1</span><span class="special">,</span> <span class="identifier">Signature2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">SignatureK</span><span class="special">&gt;</span> <span class="identifier">base_type</span><span class="special">;</span>
+
+ <span class="comment">// wrapped function type</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <span class="identifier">wrapped_function</span> <a name="ref_overload_wrapped_function"></a>
+ <span class="special">{</span>
+ <span class="keyword">typedef</span> boost::function<span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span> <span class="identifier">type</span><span class="special">;</span>
+ <span class="special">};</span>
+
+ <span class="comment">// static constants</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">extent</span> <span class="special">=</span> <a class="link" href="references.html#ref_tt_extent">extent</a><span class="special">&lt;</span><a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">;</span> <a name="ref_overload_extent"></a>
+
+ <span class="comment">// <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_type_traits" title="overload type traits">type traits</a></span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_overload_tt_signature">signature</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_overload_tt_function">function</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_overload_tt_index_of_sig">index_of_signature</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_overload_tt_has_signature">has_signature</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_overload_tt_shares_any_sig_with">shares_any_signature_with</a><span class="special">;</span>
+
+ <span class="comment">// Lambda library support</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Args</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <span class="identifier">sig</span><span class="special">;</span>
+
+ <span class="comment">// ResultOf library support</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallType</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <span class="identifier">result</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_ctor_copy_dtor" title="overload public construct/copy/destruct">construct/copy/destruct </a></span>
+ <a class="link" href="references.html#ref_overload_default_ctor"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">();</span>
+ <a class="link" href="references.html#ref_overload_copy_ctor"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_ctor_F1"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Functor</span><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_ctor_F1___FN"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">typename</span> <span class="identifier">FN</span><span class="special">&gt;</span> <span class="comment">// N == <a class="link" href="references.html#ref_overload_extent">extent</a></span>
+ <a class="link" href="references.html#ref_overload_ctor_F1___FN"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;,</span> <span class="special">...,</span> <span class="keyword">const</span> <span class="identifier">FN</span><span class="special">&amp;</span> <span class="special">);</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_op_assign"><code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="special">);</span>
+ <a class="link" href="references.html#ref_overload_dtor">~<code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">();</span>
+
+ <span class="comment">// <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_modifiers" title="overload modifiers">modifiers</a></span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Functor</span><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_set_F1___FN"><code class="computeroutput"><span class="identifier">set</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">typename</span> <span class="identifier">FN</span><span class="special">&gt;</span> <span class="comment">// N == <a class="link" href="references.html#ref_overload_extent">extent</a></span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_set_F1___FN"><code class="computeroutput"><span class="identifier">set</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;,</span> <span class="special">...,</span> <span class="keyword">const</span> <span class="identifier">FN</span><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Functor</span><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_set_N_F"><code class="computeroutput"><span class="identifier">set</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Functor</span><span class="special">&amp;</span> <span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_set_for_each_shared_sig"><code class="computeroutput"><span class="identifier">set_for_each_shared_signature</span></code></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Functor</span><span class="special">&amp;</span> <span class="special">);</span>
+
+ <span class="keyword">void</span> <a class="link" href="references.html#ref_overload_swap"><code class="computeroutput"><span class="identifier">swap</span></code></a><span class="special">(</span><a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <a class="link" href="references.html#ref_overload_swap_function"><code class="computeroutput"><span class="identifier">swap_function</span></code></a><span class="special">(</span>boost::function<span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;&amp;</span> <span class="special">);</span>
+
+ <span class="keyword">void</span> <a class="link" href="references.html#ref_overload_clear_all"><code class="computeroutput"><span class="identifier">clear_all</span></code></a><span class="special">();</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <a class="link" href="references.html#ref_overload_clear_S"><code class="computeroutput"><span class="identifier">clear</span></code></a><span class="special">();</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <a class="link" href="references.html#ref_overload_clear_N"><code class="computeroutput"><span class="identifier">clear</span></code></a><span class="special">();</span>
+
+ <span class="comment">// <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_capacity" title="overload capacity">capacity</a></span>
+ <span class="keyword">bool</span> <a class="link" href="references.html#ref_overload_empty_all"><code class="computeroutput"><span class="identifier">empty_all</span></code></a><span class="special">();</span>
+ <span class="keyword">bool</span> <a class="link" href="references.html#ref_overload_empty_any"><code class="computeroutput"><span class="identifier">empty_any</span></code></a><span class="special">();</span>
+ <span class="keyword">bool</span> <a class="link" href="references.html#ref_overload_empty_none"><code class="computeroutput"><span class="identifier">empty_none</span></code></a><span class="special">();</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">();</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <a class="link" href="references.html#ref_overload_empty_N"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">();</span>
+
+ <span class="comment">// <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_function_access" title="overload function access">function access</a></span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <a class="link" href="references.html#ref_overload_wrapped_function">wrapped_function</a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_get_S"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">();</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <a class="link" href="references.html#ref_overload_tt_function">function</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_get_N"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">();</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">const</span> <span class="keyword">typename</span> <a class="link" href="references.html#ref_overload_wrapped_function">wrapped_function</a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_get_S_const"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">const</span> <span class="keyword">typename</span> <a class="link" href="references.html#ref_overload_tt_function">function</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <a class="link" href="references.html#ref_overload_get_N_const"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+<span class="special">};</span>
+
+<span class="comment">// <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_specialized_algorithms" title="overload specialized algorithms">specialized algorithms</a></span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">S1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">S2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">SK</span><span class="special">&gt;</span> <span class="comment">// K == BOOST_OVERLOAD_LIMITS</span>
+<span class="keyword">void</span> <a class="link" href="references.html#ref_global_overload_swap"><code class="computeroutput"><span class="identifier">swap</span></code></a><span class="special">(</span><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">&lt;</span><span class="identifier">S1</span><span class="special">,</span> <span class="identifier">S2</span><span class="special">,...,</span><span class="identifier">SK</span><span class="special">&gt;&amp;,</span> <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">&lt;</span><span class="identifier">S1</span><span class="special">,</span> <span class="identifier">S2</span><span
class="special">,...,</span><span class="identifier">SK</span><span class="special">&gt;&amp;</span> <span class="special">);</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description" title="Description">Description</a>
+</h5></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_type_traits">overload
+ type traits</a></span></dt>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_ctor_copy_dtor">overload
+ public construct/copy/destruct</a></span></dt>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_modifiers">overload
+ modifiers</a></span></dt>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_capacity">overload
+ capacity</a></span></dt>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_function_access">overload
+ function access</a></span></dt>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_specialized_algorithms">overload
+ specialized algorithms</a></span></dt>
+</dl></div>
+<p>
+ Class template <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> behaves as an overloaded
+ boost::function. Actually it wraps
+ multiple boost::function objects of different
+ call signatures. In this context N is equal to <code class="computeroutput"><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">::</span><a class="link" href="references.html#ref_overload_extent">extent</a></code> and refers to the
+ number of supported call signatures.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_type_traits"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_type_traits" title="overload type traits">overload
+ type traits</a>
+</h6></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_overload_tt_signature"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">signature</span><span class="special">;</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: The index <code class="computeroutput"><span class="identifier">I</span></code> is such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">signature</span><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is the <code class="computeroutput"><span class="special">(</span><span class="identifier">I</span><span class="special">+</span><span class="number">1</span><span class="special">)</span></code>-th
+ call signature listed in the template argument list of <a class="link" href="references.html#ref_overload_this_type">this_type</a>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_tt_function"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">function</span><span class="special">;</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: The index <code class="computeroutput"><span class="identifier">I</span></code> is such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is the same as <code class="computeroutput">boost::function<span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;</span></code>,
+ where S is the call signature <code class="computeroutput"><a class="link" href="references.html#ref_overload_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_tt_index_of_sig"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">index_of_signature</span><span class="special">;</span></code><br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">index_of_signature</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is an integral constant that represents the position, starting
+ from 0, of the call signature <code class="computeroutput"><span class="identifier">Signature</span></code>
+ in the template argument list of <a class="link" href="references.html#ref_overload_this_type">this_type</a>
+ if it is present and <code class="computeroutput"><span class="special">-</span><span class="number">1</span></code> otherwise .<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_tt_has_signature"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">has_signature</span><span class="special">;</span></code><br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">has_signature</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">value</span></code> is a boolean constant equals
+ to <code class="computeroutput"><span class="keyword">true</span></code> if <a class="link" href="references.html#ref_overload_this_type">this_type</a>
+ supports the call signature <code class="computeroutput"><span class="identifier">Signature</span></code>
+ and <code class="computeroutput"><span class="keyword">false</span></code> otherwise.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_tt_shares_any_sig_with"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">shares_any_signature_with</span><span class="special">;</span></code><br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">shares_any_signature_with</span><span class="special">&lt;</span><span class="identifier">Functor</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is a boolean constant equals to <code class="computeroutput"><span class="keyword">true</span></code>
+ if <a class="link" href="references.html#ref_overload_this_type">this_type</a> shares
+ at least one call signature with the <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object type</a> <code class="computeroutput"><span class="identifier">Functor</span></code>.<br>
+ <br>
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_ctor_copy_dtor"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_ctor_copy_dtor" title="overload public construct/copy/destruct">overload
+ public construct/copy/destruct</a>
+</h6></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_overload_default_ctor"></a> <code class="computeroutput"><span class="identifier">overload</span><span class="special">();</span></code><br> <span class="bold"><strong>Post
+ conditions</strong></span>: <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_all"><code class="computeroutput"><span class="identifier">empty_all</span></code></a><span class="special">()</span></code>.<br>
+ <span class="bold"><strong>Throws</strong></span>: Will not throw.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_copy_ctor"></a> <code class="computeroutput"><span class="identifier">overload</span><span class="special">(</span><span class="keyword">const</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">f</span><span class="special">);</span></code><br> <span class="bold"><strong>Post
+ conditions</strong></span>: Each object target is in the same state
+ as the copied object target of <code class="computeroutput"><span class="identifier">f</span></code>.<br>
+ <span class="bold"><strong>Throws</strong></span>: Will not throw unless
+ copying one of the object targets of <code class="computeroutput"><span class="identifier">f</span></code>
+ throws.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_ctor_F1"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Functor</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="identifier">overload</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Functor</span><span class="special">&amp;</span> <span class="identifier">f</span><span class="special">);</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">f</span></code> is a monomorphic
+ <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a> that is callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: The object target related to <code class="computeroutput"><span class="identifier">S</span></code> is a copy of <code class="computeroutput"><span class="identifier">f</span></code> if <code class="computeroutput"><span class="identifier">f</span></code>
+ is not empty or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code>
+ if <code class="computeroutput"><span class="identifier">f</span></code> is empty,
+ where <code class="computeroutput"><span class="identifier">S</span></code> is the
+ call signature supported by <code class="computeroutput"><span class="identifier">f</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_ctor_F1___FN"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">F1</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span>
+ <span class="keyword">typename</span> <span class="identifier">FN</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="identifier">overload</span><span class="special">(</span><span class="keyword">const</span>
+ <span class="identifier">F1</span><span class="special">&amp;</span>
+ <span class="identifier">f1</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;</span> <span class="identifier">f2</span><span class="special">,</span> <span class="special">...,</span>
+ <span class="keyword">const</span> <span class="identifier">FN</span><span class="special">&amp;</span> <span class="identifier">fN</span><span class="special">);</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">f1</span><span class="special">,</span><span class="identifier">f2</span><span class="special">,...,</span><span class="identifier">fN</span></code> are monomorphic <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a>s that are callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: For each <code class="computeroutput"><span class="identifier">I</span><span class="special">=</span><span class="number">1</span><span class="special">,...</span><span class="identifier">N</span></code>
+ the object target related to <code class="computeroutput"><span class="identifier">S</span></code>
+ is a copy of <code class="computeroutput"><span class="identifier">fI</span></code>
+ if <code class="computeroutput"><span class="identifier">fI</span></code> is not empty
+ or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code> if <code class="computeroutput"><span class="identifier">fI</span></code>
+ is empty, where <code class="computeroutput"><span class="identifier">S</span></code>
+ is the call signature supported by <code class="computeroutput"><span class="identifier">fI</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_op_assign"></a> <code class="computeroutput"> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span>
+ <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">f</span><span class="special">);</span></code><br> <span class="bold"><strong>Post
+ conditions</strong></span>: If copy construction does not throw, for
+ each supported call signature <code class="computeroutput"><span class="identifier">S</span></code>
+ <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ targets a copy of <code class="computeroutput"><span class="identifier">f</span></code>'s
+ target related to <code class="computeroutput"><span class="identifier">S</span></code>,
+ if it has one, or is empty if <code class="computeroutput"><span class="identifier">f</span><span class="special">.</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code>.
+ If copy construction does throw while copying the <code class="computeroutput"><span class="identifier">I</span></code>-th object target then <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_get_N"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">&lt;</span><span class="identifier">J</span><span class="special">&gt;()</span></code> is a copy of <code class="computeroutput"><span class="identifier">f</span><span class="special">.</span><a class="link" href="references.html#ref_overload_get_N"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">&lt;</span><span class="identifier">J</span><span class="special">&gt;</span></code> for <code class="computeroutput"><span class="identifier">J</span><span class="special">&lt;</span><span class="identifier">I</span></code>,
+ <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_get_N"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">&lt;</span><span class="identifier">J</span><span class="special">&gt;()</span></code> is not modified for <code class="computeroutput"><span class="identifier">J</span><span class="special">&gt;</span><span class="identifier">I</span></code> and finally <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_N"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;()</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_dtor"></a> <code class="computeroutput"><span class="special">~</span><span class="identifier">overload</span><span class="special">();</span></code>
+ <br> <span class="bold"><strong>Effetcs</strong></span>: Destroys each
+ non-empty target. <br>
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_modifiers"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_modifiers" title="overload modifiers">overload
+ modifiers</a>
+</h6></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_overload_set_F1"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Functor</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span>
+ <span class="identifier">Functor</span><span class="special">&amp;</span>
+ <span class="identifier">f</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: <code class="computeroutput"><span class="identifier">f</span></code>
+ is a monomorphic <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a> that is callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: The object target related to <code class="computeroutput"><span class="identifier">S</span></code> is a copy of <code class="computeroutput"><span class="identifier">f</span></code> if <code class="computeroutput"><span class="identifier">f</span></code>
+ is not empty or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code>
+ if <code class="computeroutput"><span class="identifier">f</span></code> is empty,
+ where <code class="computeroutput"><span class="identifier">S</span></code> is the
+ call signature supported by <code class="computeroutput"><span class="identifier">f</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_set_F1___FN"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">F1</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span>
+ <span class="keyword">typename</span> <span class="identifier">FN</span><span class="special">&gt;</span></code><br> <code class="computeroutput"> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span>
+ <span class="identifier">F1</span><span class="special">&amp;</span>
+ <span class="identifier">f1</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;</span> <span class="identifier">f2</span><span class="special">,</span> <span class="special">...,</span>
+ <span class="keyword">const</span> <span class="identifier">FN</span><span class="special">&amp;</span> <span class="identifier">fN</span><span class="special">);</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">f1</span><span class="special">,</span><span class="identifier">f2</span><span class="special">,...,</span><span class="identifier">fN</span></code> are monomorphic <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a>s that are callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: For each <code class="computeroutput"><span class="identifier">I</span><span class="special">=</span><span class="number">1</span><span class="special">,...</span><span class="identifier">N</span></code>
+ the object target related to <code class="computeroutput"><span class="identifier">S</span></code>
+ is a copy of <code class="computeroutput"><span class="identifier">fI</span></code>
+ if <code class="computeroutput"><span class="identifier">fI</span></code> is not empty
+ or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code> if <code class="computeroutput"><span class="identifier">fI</span></code>
+ is empty, where <code class="computeroutput"><span class="identifier">S</span></code>
+ is the call signature supported by <code class="computeroutput"><span class="identifier">fI</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_set_S_F"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span></code><br> <code class="computeroutput"> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span>
+ <span class="identifier">Functor</span><span class="special">&amp;</span>
+ <span class="identifier">f</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: <code class="computeroutput"><span class="identifier">Signature</span></code>
+ is a call signature supported by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> and <code class="computeroutput"><span class="identifier">f</span></code>
+ is a <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a> that is callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: The object target related to the call signature
+ <code class="computeroutput"><span class="identifier">Signature</span></code> is a
+ copy of <code class="computeroutput"><span class="identifier">f</span></code> if <code class="computeroutput"><span class="identifier">f</span></code> is not empty or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;()</span></code> if <code class="computeroutput"><span class="identifier">f</span></code>
+ is empty.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_set_N_F"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">typename</span>
+ <span class="identifier">Functor</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span>
+ <span class="identifier">Functor</span><span class="special">&amp;</span>
+ <span class="identifier">f</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: The index <code class="computeroutput"><span class="identifier">I</span></code> is such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code> and <code class="computeroutput"><span class="identifier">f</span></code>
+ is a <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a> that is callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: The object target related to the call signature
+ <code class="computeroutput"><span class="identifier">S</span><span class="special">:=</span><a class="link" href="references.html#ref_overload_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is a copy of <code class="computeroutput"><span class="identifier">f</span></code> if <code class="computeroutput"><span class="identifier">f</span></code>
+ is not empty or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code>
+ if <code class="computeroutput"><span class="identifier">f</span></code> is empty.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_set_for_each_shared_sig"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span></code><br> <code class="computeroutput"> <a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span> <span class="identifier">set_for_each_shared_signature</span><span class="special">(</span><span class="keyword">const</span>
+ <span class="identifier">Functor</span><span class="special">&amp;</span>
+ <span class="identifier">f</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: <code class="computeroutput"><span class="identifier">f</span></code>
+ is a <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a> that is callable by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> with any call signature shared
+ by both <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ and <code class="computeroutput"><span class="identifier">f</span></code>.<br> <span class="bold"><strong>Post conditions</strong></span>: For each call signature
+ <code class="computeroutput"><span class="identifier">S</span></code> shared by both
+ <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ and <code class="computeroutput"><span class="identifier">f</span></code> the object
+ target related to <code class="computeroutput"><span class="identifier">S</span></code>
+ is a copy of <code class="computeroutput"><span class="identifier">f</span></code>
+ if <code class="computeroutput"><span class="identifier">f</span></code> is not empty
+ or <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code> if <code class="computeroutput"><span class="identifier">f</span></code>
+ is empty.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_swap"></a> <code class="computeroutput"><span class="keyword">void</span>
+ <span class="identifier">swap</span><span class="special">(</span><a class="link" href="references.html#ref_overload_this_type">this_type</a><span class="special">&amp;</span>
+ <span class="identifier">f</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Effetcs</strong></span>: For each supported call
+ signature <code class="computeroutput"><span class="identifier">S</span></code> interchanges
+ the object targets of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> and <code class="computeroutput"><span class="identifier">f</span></code>
+ related to <code class="computeroutput"><span class="identifier">S</span></code><br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_swap_function"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">swap_function</span><span class="special">(</span>boost::function<span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;&amp;</span>
+ <span class="identifier">f</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: <code class="computeroutput"><span class="identifier">Signature</span></code>
+ is a call signature supported by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Effetcs</strong></span>:
+ Interchanges the object target of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> related to the call signature
+ <code class="computeroutput"><span class="identifier">Signature</span></code> with
+ the object target of <code class="computeroutput"><span class="identifier">f</span></code>.
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_clear_all"></a> <code class="computeroutput"><span class="keyword">void</span>
+ <span class="identifier">clear_all</span><span class="special">();</span></code><br>
+ <span class="bold"><strong>Post conditions</strong></span>: <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_all"><code class="computeroutput"><span class="identifier">empty_all</span></code></a><span class="special">()</span></code>.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_clear_S"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">clear</span><span class="special">();</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">Signature</span></code> is a
+ call signature supported by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;()</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_clear_N"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">void</span>
+ <span class="identifier">clear</span><span class="special">();</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: The index <code class="computeroutput"><span class="identifier">I</span></code> is such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code>.<br> <span class="bold"><strong>Post
+ conditions</strong></span>: <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_N"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;()</span></code>.<br>
+ <br>
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_capacity"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_capacity" title="overload capacity">overload
+ capacity</a>
+</h6></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_overload_empty_all"></a> <code class="computeroutput"><span class="keyword">bool</span>
+ <span class="identifier">empty_all</span><span class="special">();</span></code><br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="keyword">false</span></code>
+ if <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ has at least one call signature <code class="computeroutput"><span class="identifier">S</span></code>
+ such that <code class="computeroutput"><span class="special">!</span><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code>
+ and <code class="computeroutput"><span class="keyword">true</span></code> otherwise.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_empty_any"></a> <code class="computeroutput"><span class="keyword">bool</span>
+ <span class="identifier">empty_any</span><span class="special">();</span></code><br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="keyword">false</span></code>
+ if for each supported call signature <code class="computeroutput"><span class="identifier">S</span></code>
+ <code class="computeroutput"><span class="special">!</span><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code>
+ and <code class="computeroutput"><span class="keyword">true</span></code> otherwise.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_empty_none"></a> <code class="computeroutput"><span class="keyword">bool</span>
+ <span class="identifier">empty_none</span><span class="special">();</span></code><br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="keyword">false</span></code>
+ if <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ has at least one call signature <code class="computeroutput"><span class="identifier">S</span></code>
+ such that <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;()</span></code> and <code class="computeroutput"><span class="keyword">true</span></code>
+ otherwise.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_empty_S"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">();</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">Signature</span></code> is a
+ call signature supported by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="keyword">false</span></code> if <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_get_S"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;()</span></code> has a target and <code class="computeroutput"><span class="keyword">true</span></code> otherwise.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_empty_N"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">bool</span>
+ <span class="identifier">empty</span><span class="special">();</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: The index <code class="computeroutput"><span class="identifier">I</span></code> is such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="keyword">false</span></code> if <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span><a class="link" href="references.html#ref_overload_get_N"><code class="computeroutput"><span class="identifier">get</span></code></a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;()</span></code> has a target and <code class="computeroutput"><span class="keyword">true</span></code> otherwise.<br> <br>
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_function_access"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_function_access" title="overload function access">overload
+ function access</a>
+</h6></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_overload_get_S"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">typename</span> <a class="link" href="references.html#ref_overload_wrapped_function">wrapped_function</a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <span class="identifier">get</span><span class="special">();</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">Signature</span></code> is a
+ call signature supported by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ a reference to the unique embedded object of type <code class="computeroutput">boost::function<span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_get_N"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">typename</span>
+ <a class="link" href="references.html#ref_overload_tt_function">function</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <span class="identifier">get</span><span class="special">();</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ The index <code class="computeroutput"><span class="identifier">I</span></code> is
+ such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ a reference to the unique embedded object of type <code class="computeroutput">boost::function<span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;</span></code>
+ where <code class="computeroutput"><span class="identifier">S</span></code> is the
+ call signature <code class="computeroutput"><a class="link" href="references.html#ref_overload_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code><br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_get_S_const"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">typename</span>
+ <a class="link" href="references.html#ref_overload_wrapped_function">wrapped_function</a><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ <code class="computeroutput"><span class="identifier">Signature</span></code> is a
+ call signature supported by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ a const reference to the unique embedded object of type <code class="computeroutput">boost::function<span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;</span></code>
+ where <code class="computeroutput"><span class="identifier">S</span></code> is the
+ call signature <code class="computeroutput"><a class="link" href="references.html#ref_overload_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code><br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_overload_get_N_const"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">unsigned</span>
+ <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">const</span>
+ <span class="keyword">typename</span> <a class="link" href="references.html#ref_overload_tt_function">function</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&amp;</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ The index <code class="computeroutput"><span class="identifier">I</span></code> is
+ such that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code>.<br> <span class="bold"><strong>Returns</strong></span>:
+ a const reference to the unique embedded object of type <code class="computeroutput">boost::function<span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code><br>
+ <br>
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_specialized_algorithms"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_specialized_algorithms" title="overload specialized algorithms">overload
+ specialized algorithms</a>
+</h6></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+ <a name="ref_global_overload_swap"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">S1</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">S2</span><span class="special">,</span> <span class="keyword">typename</span>
+ <span class="identifier">SK</span><span class="special">&gt;</span>
+ <span class="comment">// K == BOOST_OVERLOAD_LIMITS</span></code><br>
+ <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">&lt;</span><span class="identifier">S1</span><span class="special">,</span>
+ <span class="identifier">S2</span><span class="special">,...,</span><span class="identifier">SK</span><span class="special">&gt;&amp;</span>
+ <span class="identifier">f1</span><span class="special">,</span>
+ <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">&lt;</span><span class="identifier">S1</span><span class="special">,</span>
+ <span class="identifier">S2</span><span class="special">,...,</span><span class="identifier">SK</span><span class="special">&gt;&amp;</span>
+ <span class="identifier">f2</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Effects</strong></span>: <code class="computeroutput"><span class="identifier">f1</span><span class="special">.</span><a class="link" href="references.html#ref_overload_swap"><code class="computeroutput"><span class="identifier">swap</span></code></a><span class="special">(</span><span class="identifier">f2</span><span class="special">)</span></code>.
+ <br>
+ </li></ol></div>
+</div>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.references.boost_overload_hpp.call_wrapper_type_traits"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.call_wrapper_type_traits" title="Call Wrapper Type Traits">Call
+ Wrapper Type Traits</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_overload.references.boost_overload_hpp.call_wrapper_type_traits.synopsis"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.call_wrapper_type_traits.synopsis" title="Synopsis">Synopsis</a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">overloads</span><span class="special">{</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallWrapperType</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_tt_extent">extent</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_tt_signature">signature</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">I</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_tt_function">function</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_tt_index_of_sig">index_of_signature</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_tt_has_signature">has_signature</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <a class="link" href="references.html#ref_tt_have_any_shared_sig">have_any_shared_signature</a><span class="special">;</span>
+
+<span class="special">}</span> <span class="special">}</span> <span class="comment">// end namespaces</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_overload.references.boost_overload_hpp.call_wrapper_type_traits.description"></a><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.call_wrapper_type_traits.description" title="Description">Description</a>
+</h5></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_tt_extent"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">CallWrapperType</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">extent</span><span class="special">;</span></code><br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">extent</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">&gt;::</span><span class="identifier">value</span></code> is a non-negative integral
+ constant equals to the number of call signatures supported by <code class="computeroutput"><span class="identifier">CallWrapperType</span></code>.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_tt_signature"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">CallWrapperType</span><span class="special">,</span>
+ <span class="keyword">unsigned</span> <span class="keyword">int</span>
+ <span class="identifier">I</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">signature</span><span class="special">;</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ The index <code class="computeroutput"><span class="identifier">I</span></code> is such
+ that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code> where <code class="computeroutput"><span class="identifier">N</span>
+ <span class="special">=</span> <a class="link" href="references.html#ref_tt_extent">extent</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">&gt;::</span><span class="identifier">value</span></code>.<br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="identifier">signature</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+ is the <code class="computeroutput"><span class="special">(</span><span class="identifier">I</span><span class="special">+</span><span class="number">1</span><span class="special">)</span></code>-th call signature listed in the
+ template argument list of <code class="computeroutput"><span class="identifier">CallWrapperType</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_tt_function"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">CallWrapperType</span><span class="special">,</span>
+ <span class="keyword">unsigned</span> <span class="keyword">int</span>
+ <span class="identifier">I</span><span class="special">&gt;</span></code><br>
+ <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">function</span><span class="special">;</span></code><br> <span class="bold"><strong>Requires</strong></span>:
+ The index <code class="computeroutput"><span class="identifier">I</span></code> is such
+ that <code class="computeroutput"><span class="number">0</span><span class="special">&lt;=</span><span class="identifier">I</span><span class="special">&lt;</span><span class="identifier">N</span></code> where <code class="computeroutput"><span class="identifier">N</span>
+ <span class="special">=</span> <span class="identifier">extent</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">&gt;::</span><span class="identifier">value</span></code>.<br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+ is the same as <code class="computeroutput">boost::function<span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;</span></code>,
+ where <code class="computeroutput"><span class="identifier">S</span></code> is the call
+ signature <code class="computeroutput"><a class="link" href="references.html#ref_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_tt_index_of_sig"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">CallWrapperType</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">index_of_signature</span><span class="special">;</span></code><br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="identifier">index_of_signature</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is an integral constant that represents the position, starting from
+ 0, of the call signature <code class="computeroutput"><span class="identifier">Signature</span></code>
+ in the template argument list of <code class="computeroutput"><span class="identifier">CallWrapperType</span></code>
+ if it is present and <code class="computeroutput"><span class="special">-</span><span class="number">1</span></code> otherwise .<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_tt_has_signature"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">CallWrapperType</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">has_signature</span><span class="special">;</span></code><br>
+ <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="identifier">has_signature</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is a boolean constant equals to <code class="computeroutput"><span class="keyword">true</span></code>
+ if <code class="computeroutput"><span class="identifier">CallWrapperType</span></code>
+ supports the call signature <code class="computeroutput"><span class="identifier">Signature</span></code>
+ and <code class="computeroutput"><span class="keyword">false</span></code> otherwise.<br>
+ <br>
+ </li>
+<li class="listitem">
+ <a name="ref_tt_have_any_shared_sig"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">CallWrapperType</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Functor</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">have_any_shared_signature</span><span class="special">;</span></code><br> <span class="bold"><strong>Returns</strong></span>:
+ <code class="computeroutput"><span class="identifier">have_any_shared_signature</span><span class="special">&lt;</span><span class="identifier">CallWrapperType</span><span class="special">,</span> <span class="identifier">Functor</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is a boolean constant equals to <code class="computeroutput"><span class="keyword">true</span></code>
+ if <code class="computeroutput"><span class="identifier">CallWrapperType</span></code>
+ shares at least one call signature with the <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object type</a> <code class="computeroutput"><span class="identifier">Functor</span></code>.<br>
+ <br>
+ </li>
+</ol></div>
+</div>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.references.boost_overload_make_overload_hpp"></a><a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp" title="&lt;boost/overload/make_overload.hpp&gt;">&lt;boost/overload/make_overload.hpp&gt;</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload">Generative
+ function make_overload</a></span></dt>
+<dd><dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+</dl></dd>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload"></a><a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload" title="Generative function make_overload">Generative
+ function make_overload</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload.synopsis"></a><a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload.synopsis" title="Synopsis">Synopsis</a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">overloads</span><span class="special">{</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">F2</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">no_function</span><span class="special">,</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="keyword">typename</span> <span class="identifier">FK</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">no_function</span><span class="special">&gt;</span> <span class="comment">// K == BOOST_OVERLOAD_LIMITS</span>
+ <span class="keyword">struct</span> <span class="identifier">make_overload_type</span><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">make_overload_type</span><span class="special">&lt;</span><span class="identifier">F1</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">make_overload</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;</span> <span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span> <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">make_overload_type</span><span class="special">&lt;</span><span class="identifier">F1</span><span class="special">,</span> <span class="identifier">F2</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">make_overload</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;</span> <span class="special">,</span> <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;);</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="special">.</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">typename</span> <span class="identifier">FK</span><span class="special">&gt;</span> <span class="comment">// K == BOOST_OVERLOAD_LIMITS</span>
+ <span class="keyword">typename</span> <span class="identifier">make_overload_type</span><span class="special">&lt;</span><span class="identifier">F1</span><span class="special">,</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">FK</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">make_overload</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;</span> <span class="special">,</span> <span class="keyword">const</span> <span class="identifier">F2</span><span class="special">&amp;,</span> <span class="special">...,</span><span class="keyword">const</span> <span class="identifier">FK</span><span class="special">&amp;</span> <span class="special">);</span>
+
+<span class="special">}</span> <span class="special">}</span> <span class="comment">// end namespaces</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload.description"></a><a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload.description" title="Description">Description</a>
+</h5></div></div></div>
+<p>
+ In the following context <code class="computeroutput"><span class="identifier">N</span></code>
+ is an integral constant between 1 and <code class="computeroutput"><span class="identifier">K</span><span class="special">=</span><span class="identifier">BOOST_OVERLOAD_LIMITS</span></code>.
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <a name="ref_make_overload_type"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">F1</span> <span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">typename</span> <span class="identifier">FK</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">make_overload_type</span><span class="special">;</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: <code class="computeroutput"><span class="identifier">F1</span><span class="special">,</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">FK</span></code> are <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object type</a>s with different call signatures or the <code class="computeroutput"><span class="identifier">detail</span><span class="special">::</span><span class="identifier">no_function</span></code> type.<br> <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="identifier">make_overload_type</span><span class="special">&lt;</span><span class="identifier">F1</span><span class="special">,</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">FN</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is the same type as <code class="computeroutput"><a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a><span class="special">&lt;</span><span class="identifier">S1</span><span class="sp
ecial">,</span> <span class="identifier">S2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">SN</span><span class="special">&gt;</span></code> where <code class="computeroutput"><span class="identifier">SI</span></code>
+ is the call signature of the <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object type</a> <code class="computeroutput"><span class="identifier">FI</span></code>,
+ for <code class="computeroutput"><span class="identifier">I</span><span class="special">=</span><span class="number">1</span><span class="special">,..</span><span class="identifier">N</span></code>.<br> <br>
+ </li>
+<li class="listitem">
+ <a name="ref_make_overload"></a> <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">F1</span> <span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">typename</span> <span class="identifier">FN</span><span class="special">&gt;</span></code><br> <code class="computeroutput"><span class="keyword">typename</span>
+ <span class="identifier">make_overload_type</span><span class="special">&lt;</span><span class="identifier">F1</span><span class="special">,</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">FN</span><span class="special">&gt;::</span><span class="identifier">type</span></code><br>
+ <code class="computeroutput"><span class="identifier">make_overload</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F1</span><span class="special">&amp;</span> <span class="identifier">f1</span><span class="special">,</span> <span class="keyword">const</span>
+ <span class="identifier">F2</span><span class="special">&amp;</span>
+ <span class="identifier">f2</span><span class="special">,</span>
+ <span class="special">...,</span><span class="keyword">const</span>
+ <span class="identifier">FN</span><span class="special">&amp;</span>
+ <span class="identifier">fN</span><span class="special">);</span></code><br>
+ <span class="bold"><strong>Requires</strong></span>: <code class="computeroutput"><span class="identifier">f1</span><span class="special">,</span><span class="identifier">f2</span><span class="special">,...,</span><span class="identifier">fN</span></code>
+ are monomorphic <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a>s each supporting a different call signature.<br>
+ <span class="bold"><strong>Returns</strong></span>: An <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> object <code class="computeroutput"><span class="identifier">f</span></code> that supports all and only the
+ call signatures supported by f1, ..., fN and that for each <code class="computeroutput"><span class="identifier">I</span><span class="special">=</span><span class="number">1</span><span class="special">,...,</span><span class="identifier">N</span></code> the object target related to
+ the call signature <code class="computeroutput"><a class="link" href="references.html#ref_overload_tt_signature">signature</a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+ is a copy of <code class="computeroutput"><span class="identifier">fI</span></code>.<br>
+ <br>
+ </li>
+</ol></div>
+</div>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="design_and_definitions.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/tutorial.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/tutorial.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,1052 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Tutorial</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="getting_started.html" title="Getting Started">
+<link rel="next" href="use_case.html" title="Use case">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="use_case.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Basic usage</span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.backward_compatibility__boost__overload_is_a_boost__function">Backward
+ compatibility: boost::overload is a boost::function</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities">Supported
+ types of callable entities</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_function_objects">Example
+ - Using Function Objects</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_boost_function">Example
+ - Using Boost.Function</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_member_functions">Example
+ - Using member functions</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax">The
+ call signature based syntax</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___a_multi_signature_function_object">Example
+ - A multi-signature function object</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___free_and_member_polymorphic_functions">Example
+ - Free and member polymorphic functions</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___a_functor_with_a_call_signature_that_is_only_compatible">Example
+ - A functor with a call signature that is only compatible</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_index_based_syntax">The index
+ based syntax</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_make_overload_utility">The
+ make_overload utility</a></span></dt>
+<dt><span class="section">Helper methods</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.basic_usage"></a><a class="link" href="tutorial.html#boost_overload.tutorial.basic_usage" title="Basic usage">Basic usage</a>
+</h3></div></div></div>
+<p>
+ In order to instantiate a template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> you have to specify the
+ required <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">call
+ signature</a>s as template arguments and then you can set the <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">callable
+ object</a>s as targets through the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a> method which support automatic
+ <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">call
+ signature</a> deduction of the passed argument for monomorphic functors.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="keyword">int</span> <span class="identifier">int_sum</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="keyword">float</span> <span class="identifier">float_inc</span><span class="special">(</span><span class="keyword">float</span> <span class="identifier">x</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="number">1.0f</span><span class="special">;</span>
+<span class="special">}</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">),</span> <span class="keyword">float</span> <span class="special">(</span><span class="keyword">float</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">int_sum</span><span class="special">);</span> <span class="comment">// here automatic signature</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">float_inc</span><span class="special">);</span> <span class="comment">// deduction occurs</span>
+
+ <span class="keyword">int</span> <span class="identifier">r1</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// invokes int_sum</span>
+ <span class="keyword">float</span> <span class="identifier">r2</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">(</span><span class="number">3.0f</span><span class="special">);</span> <span class="comment">// invokes float_inc</span>
+
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">r1</span> <span class="special">==</span> <span class="number">3</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">r2</span> <span class="special">==</span> <span class="number">4.0f</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ If you try to instantiate a template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> using the same <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">call
+ signature</a> as template argument more than once you get a compile
+ time error.
+ </p></td></tr>
+</table></div>
+<p>
+ Even if the callable targets are set at run-time, the function call relies
+ on standard C++ overload resolution: <span class="underline">the right
+ callable target is selected at compile time</span>, so the run-time overhead
+ for the call is the same that you have using Boost.Function.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.backward_compatibility__boost__overload_is_a_boost__function"></a><a class="link" href="tutorial.html#boost_overload.tutorial.backward_compatibility__boost__overload_is_a_boost__function" title="Backward compatibility: boost::overload is a boost::function">Backward
+ compatibility: boost::overload is a boost::function</a>
+</h3></div></div></div>
+<p>
+ For any <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">call
+ signature</a> <span class="emphasis"><em>S</em></span> used as a template argument of an
+ instantiation <span class="emphasis"><em>O</em></span> of the class template <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a>, the type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;</span></code> is
+ a base class type for the instantiation <span class="emphasis"><em>O</em></span>. That means
+ you can pass a (const) reference/pointer to an object of type <code class="computeroutput"><span class="identifier">overload</span><span class="special">&lt;..,</span><span class="identifier">S</span><span class="special">,...&gt;</span></code>
+ everywhere a (const) reference/pointer to an object of type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;</span></code> is
+ expected.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.supported_types_of_callable_entities"></a><a class="link" href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities" title="Supported types of callable entities">Supported
+ types of callable entities</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_function_objects">Example
+ - Using Function Objects</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_boost_function">Example
+ - Using Boost.Function</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_member_functions">Example
+ - Using member functions</a></span></dt>
+</dl></div>
+<p>
+ You can utilize different kinds of callable entities: free functions, <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.function_objects" title="Function Objects">function
+ object</a>s, function objects wrapped with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span></code> and
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>s. Moreover you have support for
+ member functions too. Given a member function <span class="emphasis"><em>mf</em></span> of
+ a class <code class="computeroutput"><span class="identifier">T</span></code>, all you have to
+ do is to specify a const or non-const <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">explicit
+ call signature</a> of <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span></code><span class="emphasis"><em><code class="computeroutput"><span class="identifier">mf</span></code></em></span>
+ as a template argument of <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> and pass a pointer to the
+ member function to the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a> method. You'll get an overloaded
+ function call operator that is able to perform a forwarding call to <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span></code><span class="emphasis"><em><code class="computeroutput"><span class="identifier">mf</span></code></em></span> using any object of type
+ <code class="computeroutput"><span class="identifier">T</span></code>.
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ The constructor and the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a> method can manage only monomorphic
+ callable objects, if you try to pass to them a polymorphic functor (i.e.
+ a callable object that is overloaded or that involve a template parameter)
+ you'll get a compile time error. The only exception is for a polymorphic
+ function object of class type that shares with the overload object one
+ and only one call signature.
+ </p></td></tr>
+</table></div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.tutorial.supported_types_of_callable_entities.example___using_function_objects"></a><a class="link" href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_function_objects" title="Example - Using Function Objects">Example
+ - Using Function Objects</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="comment">/* a free function */</span>
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+<span class="special">}</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature1_t</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">);</span>
+
+<span class="comment">/* a function object type */</span>
+<span class="keyword">struct</span> <span class="identifier">FuncObj1</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature2_t</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span> <span class="special">);</span>
+
+<span class="comment">/* a statefull function object type */</span>
+<span class="keyword">struct</span> <span class="identifier">FuncObj2</span>
+<span class="special">{</span>
+ <span class="identifier">FuncObj2</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">calls</span><span class="special">(</span><span class="number">0</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="special">++</span><span class="identifier">calls</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">3</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">calls</span><span class="special">;</span>
+<span class="special">};</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature3_t</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">);</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="comment">// an overload object that supports</span>
+ <span class="comment">// all the above call signatures</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">signature1_t</span><span class="special">,</span> <span class="identifier">signature2_t</span><span class="special">,</span> <span class="identifier">signature3_t</span><span class="special">&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// set a pointer to foo as target object tied to</span>
+ <span class="comment">// the first call signature</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+
+ <span class="identifier">FuncObj1</span> <span class="identifier">func_obj_1</span><span class="special">;</span>
+ <span class="comment">// func_obj_1 is cloned to an internal function</span>
+ <span class="comment">// object tied to the matching call signature</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">func_obj_1</span><span class="special">);</span>
+
+ <span class="comment">// if cloning is too expensive (e.g. your function object is</span>
+ <span class="comment">// statefull) or semantically incorrect you can wrap</span>
+ <span class="comment">// a function object with boost::ref</span>
+ <span class="identifier">FuncObj2</span> <span class="identifier">func_obj_2</span><span class="special">;</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">func_obj_2</span><span class="special">));</span>
+ <span class="comment">// no copy occurs, only a reference to func_obj_2 is kept.</span>
+
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="string">"hello"</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="number">3</span> <span class="special">);</span>
+ <span class="comment">// we keep only a reference</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">func_obj_2</span><span class="special">.</span><span class="identifier">calls</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.tutorial.supported_types_of_callable_entities.example___using_boost_function"></a><a class="link" href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_boost_function" title="Example - Using Boost.Function">Example
+ - Using Boost.Function</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="comment">/* a free function */</span>
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+<span class="special">}</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature1_t</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">);</span>
+
+<span class="comment">/* a function object type */</span>
+<span class="keyword">struct</span> <span class="identifier">FuncObj</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature2_t</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span> <span class="special">);</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="comment">// boost::function object that set foo as object target</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">signature1_t</span><span class="special">&gt;</span> <span class="identifier">foo_wrapper</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+
+ <span class="comment">// instance of FuncObj</span>
+ <span class="identifier">FuncObj</span> <span class="identifier">func_obj</span><span class="special">;</span>
+
+
+ <span class="comment">// overload object</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">signature1_t</span><span class="special">,</span> <span class="identifier">signature2_t</span><span class="special">&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// a copy of the object target held by foo_wrapper</span>
+ <span class="comment">// is created and tied to the first call signature</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">foo_wrapper</span><span class="special">);</span>
+
+ <span class="comment">// set a copy of func_obj as object target</span>
+ <span class="comment">// for the second call signature</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">func_obj</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="string">"hello"</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.tutorial.supported_types_of_callable_entities.example___using_member_functions"></a><a class="link" href="tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities.example___using_member_functions" title="Example - Using member functions">Example
+ - Using member functions</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="comment">/* a free function */</span>
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+<span class="special">}</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature1_t</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">);</span>
+
+<span class="comment">/* a member function */</span>
+<span class="keyword">class</span> <span class="identifier">Alpha</span>
+<span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">Alpha</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">_offset</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">offset</span><span class="special">(</span><span class="identifier">_offset</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">int</span> <span class="identifier">code</span><span class="special">(</span><span class="keyword">char</span> <span class="identifier">c</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(</span> <span class="identifier">c</span> <span class="special">&lt;</span> <span class="char">'a'</span> <span class="special">||</span> <span class="identifier">c</span> <span class="special">&gt;</span> <span class="char">'z'</span> <span class="special">)</span>
+ <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="special">(</span> <span class="special">(</span><span class="identifier">c</span> <span class="special">-</span> <span class="char">'a'</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">offset</span> <span class="special">)</span> <span class="special">%</span> <span class="number">26</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">int</span> <span class="identifier">offset</span><span class="special">;</span>
+<span class="special">};</span>
+<span class="comment">// member function explicit non-const signature</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">signature2_t</span> <span class="special">(</span><span class="identifier">Alpha</span><span class="special">*,</span> <span class="keyword">char</span> <span class="special">);</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">Alpha</span> <span class="identifier">alpha</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">signature1_t</span><span class="special">,</span> <span class="identifier">signature2_t</span><span class="special">&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="comment">// we pass a pointer to the member fuction Alpha::code</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">Alpha</span><span class="special">::</span><span class="identifier">code</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="string">"hello"</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+ <span class="comment">// invokes alpha.code('x')</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">alpha</span><span class="special">,</span> <span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<p>
+ In the above examples we have always set a single callable object at time,
+ however the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a>
+ method is able to set up multiple callable objects at once. For instance
+ referring to the last example you can write:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">Alpha</span><span class="special">::</span><span class="identifier">code</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ The order you pass the callable objects does not matter. You could have written
+ the previous line of code as <code class="computeroutput"><span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">Alpha</span><span class="special">::</span><span class="identifier">code</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">foo</span><span class="special">)</span></code>. Moreover you can pass the callable objects
+ directly in the constructor:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">signature1_t</span><span class="special">,</span> <span class="identifier">signature2_t</span><span class="special">&gt;</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">Alpha</span><span class="special">::</span><span class="identifier">code</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ As for the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a>
+ method the order of the arguments does not matter and you can pass only monomorphic
+ callable objects. Moreover both the constructor and the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a> method accept only callable
+ objects whose call signature is equal to one of the call signatures supported
+ by the overload object. For instance the following lines of code do not compile:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">){</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+<span class="keyword">int</span> <span class="identifier">bar</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">foo</span><span class="special">);</span> <span class="comment">// ok foo call signature matches</span>
+ <span class="comment">// the first call signature of f</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">(&amp;</span><span class="identifier">bar</span><span class="special">);</span> <span class="comment">// compile error: bar call signature does not</span>
+ <span class="comment">// match any call signature supported by f</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ If you try to pass to the constructor or to the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a> method a callable object with
+ a call signature that does not match one of the call signatures supported
+ by the given instantiation of the template class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> you get a compile time
+ error.
+ </p></td></tr>
+</table></div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ The <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a>
+ method does not work properly with Boost.Bind
+ and Boost.Lambda
+ </p></td></tr>
+</table></div>
+<p>
+ In order to workaround the limitations of the <a class="link" href="references.html#ref_overload_set_F1"><code class="computeroutput"><span class="identifier">set</span></code></a> method you should utilize the
+ <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a> or the <a class="link" href="references.html#ref_overload_set_N_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">N</span><span class="special">&gt;</span></code></a>
+ methods.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.the_call_signature_based_syntax"></a><a class="link" href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax" title="The call signature based syntax">The
+ call signature based syntax</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___a_multi_signature_function_object">Example
+ - A multi-signature function object</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___free_and_member_polymorphic_functions">Example
+ - Free and member polymorphic functions</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___a_functor_with_a_call_signature_that_is_only_compatible">Example
+ - A functor with a call signature that is only compatible</a></span></dt>
+</dl></div>
+<p>
+ If you need to set a polymorphic callable object as object target of a given
+ overload object for a specific supported call signature you can always use
+ the <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a> method. Look at the following
+ examples:
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.tutorial.the_call_signature_based_syntax.example___a_multi_signature_function_object"></a><a class="link" href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___a_multi_signature_function_object" title="Example - A multi-signature function object">Example
+ - A multi-signature function object</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">/* polymorphic function object */</span>
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">(</span> <span class="number">2</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">);</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// function object</span>
+ <span class="identifier">bar</span> <span class="identifier">foo</span><span class="special">;</span>
+
+ <span class="comment">// we use the call signature syntax for setting a copy of</span>
+ <span class="comment">// foo as object target for the call signature int (char )</span>
+ <span class="comment">// only</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">)&gt;(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="comment">// invokes int foo(char ) template instantiation</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="comment">// through the empty&lt;Signature&gt;() method we check</span>
+ <span class="comment">// that no other object target has been set up</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// now we set a copy of foo as object target tied to</span>
+ <span class="comment">// the call signature int( int )</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// and finally we set up also the object target</span>
+ <span class="comment">// for the int(double ) call signature</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Any method that accepts a polymorphic function object as argument accepts
+ also an instance of the class template <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a>.
+ </p></td></tr>
+</table></div>
+<p>
+ All that work for free and member polymorphic functions too:
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.tutorial.the_call_signature_based_syntax.example___free_and_member_polymorphic_functions"></a><a class="link" href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___free_and_member_polymorphic_functions" title="Example - Free and member polymorphic functions">Example
+ - Free and member polymorphic functions</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">(</span><span class="number">3</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">));</span> <span class="special">}</span>
+
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">mf</span><span class="special">(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">int</span> <span class="identifier">mf</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">),</span>
+ <span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">double</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// bar instance</span>
+ <span class="identifier">bar</span> <span class="identifier">abar</span><span class="special">;</span>
+
+ <span class="comment">// set bar::*mf as object target</span>
+ <span class="comment">// for the int (bar*, int ) call signature only</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">int</span> <span class="special">)&gt;(&amp;</span><span class="identifier">bar</span><span class="special">::</span><span class="identifier">mf</span><span class="special">);</span>
+ <span class="comment">// invokes int bar.mf(int )</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">abar</span><span class="special">,</span> <span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">abar</span><span class="special">.</span><span class="identifier">mf</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">double</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// set bar::*mf as object target</span>
+ <span class="comment">// for the int (bar*, double ) call signature too</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">bar</span><span class="special">*,</span> <span class="keyword">double</span> <span class="special">)&gt;(&amp;</span><span class="identifier">bar</span><span class="special">::</span><span class="identifier">mf</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">abar</span><span class="special">,</span> <span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">abar</span><span class="special">.</span><span class="identifier">mf</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(&amp;</span><span class="identifier">abar</span><span class="special">,</span> <span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">abar</span><span class="special">.</span><span class="identifier">mf</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="comment">// set *foo as object target</span>
+ <span class="comment">// for the int (int ) call signature only</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// set *foo as object target</span>
+ <span class="comment">// for the int (double ) call signature too</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Obviously, in case you wish, you can use the <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a>
+ method with monomorphic callable objects too.
+ </p></td></tr>
+</table></div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Given a template free function <code class="computeroutput"><span class="identifier">foo</span></code>
+ and a call signature <span class="emphasis"><em>S</em></span>, supported by <code class="computeroutput"><span class="identifier">foo</span></code>, the expression <code class="computeroutput"><span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;(&amp;</span><span class="identifier">foo</span><span class="special">)</span></code>, where <code class="computeroutput"><span class="identifier">f</span></code>
+ is an overload object that supports the call signature <span class="emphasis"><em>S</em></span>,
+ compiles without any error only if all template parameters involved in
+ the declaration of <code class="computeroutput"><span class="identifier">foo</span></code>
+ are deducible by the call signature <span class="emphasis"><em>S</em></span>. The same applies
+ to template member functions and template function objects.
+ </p></td></tr>
+</table></div>
+<p>
+ The call signature synatx let us set up as object target a functor whose
+ call signature is compatible with, but does not match a given call signature
+ of an overload object. This situation is showed in the following example:
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_overload.tutorial.the_call_signature_based_syntax.example___a_functor_with_a_call_signature_that_is_only_compatible"></a><a class="link" href="tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax.example___a_functor_with_a_call_signature_that_is_only_compatible" title="Example - A functor with a call signature that is only compatible">Example
+ - A functor with a call signature that is only compatible</a>
+</h4></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;</span> <span class="identifier">f1</span><span class="special">;</span>
+
+ <span class="comment">// the call signature of the foo free function does not</span>
+ <span class="comment">// match exactly any call signature of f1, anyway it is</span>
+ <span class="comment">// compatible with the call signature int (int )</span>
+ <span class="comment">// because an int type convert implicitly to a double</span>
+ <span class="comment">// for this reason the set&lt;Signature&gt; method let you</span>
+ <span class="comment">// pass as argument a functor whose call signature is only</span>
+ <span class="comment">// compatible with the call signature Signature</span>
+ <span class="identifier">f1</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;(</span> <span class="special">&amp;</span><span class="identifier">foo</span> <span class="special">);</span>
+ <span class="comment">// ok the target object tied to the int (int )</span>
+ <span class="comment">// call signature is set</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f1</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+ <span class="comment">// foo is invoked</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f1</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="comment">// all that work even if the overload object owns a call</span>
+ <span class="comment">// signature that matches exactly the call signature of the</span>
+ <span class="comment">// functor</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;</span> <span class="identifier">f2</span><span class="special">;</span>
+
+ <span class="comment">// all work exactly as before</span>
+ <span class="identifier">f2</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;(</span> <span class="special">&amp;</span><span class="identifier">foo</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f2</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f2</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="comment">// no object target has been set up for</span>
+ <span class="comment">// the int (double ) call signature</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f2</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;()</span> <span class="special">);</span>
+
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.the_index_based_syntax"></a><a class="link" href="tutorial.html#boost_overload.tutorial.the_index_based_syntax" title="The index based syntax">The index
+ based syntax</a>
+</h3></div></div></div>
+<p>
+ Besides the <a class="link" href="references.html#ref_overload_set_S_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a> method you can utilize also the
+ <a class="link" href="references.html#ref_overload_set_N_F"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">N</span><span class="special">&gt;</span></code></a>
+ method where <code class="computeroutput"><span class="identifier">N</span></code> must be an
+ integer included in the range from 0 to the number of call signatures supported
+ by the given overload object less one. Given an overload object <code class="computeroutput"><span class="identifier">f</span></code> and a functor <code class="computeroutput"><span class="identifier">g</span></code>,
+ the call <code class="computeroutput"><span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">N</span><span class="special">&gt;(</span><span class="identifier">g</span><span class="special">)</span></code> is equivalent
+ to the call <code class="computeroutput"><span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;(</span><span class="identifier">g</span><span class="special">)</span></code> where
+ <code class="computeroutput"><span class="identifier">S</span></code> is the N-1 call signature
+ listed in the template argument list for the instantiation of the type of
+ the overload object <code class="computeroutput"><span class="identifier">f</span></code>. As
+ an example we reimplement the example that shows how to set up a polymorphic
+ function object by using the index based syntax.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">/* polymorphic function object */</span>
+<span class="keyword">struct</span> <span class="identifier">bar</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">int</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">(</span> <span class="number">2</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">);</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">),</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+
+ <span class="comment">// function object</span>
+ <span class="identifier">bar</span> <span class="identifier">foo</span><span class="special">;</span>
+
+ <span class="comment">// we use the index syntax for setting a copy of</span>
+ <span class="comment">// foo as object target for the second call signature</span>
+ <span class="comment">// int (char ) only</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="comment">// invokes int foo(char ) template instantiation</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="comment">// through the empty&lt;N&gt;() method we check</span>
+ <span class="comment">// that no other object target has been set up</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// now we set a copy of foo as object target tied to</span>
+ <span class="comment">// the first call signature int( int )</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="comment">// and finally we set up also the object target</span>
+ <span class="comment">// for the last call signature int(double )</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;(</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.the_make_overload_utility"></a><a class="link" href="tutorial.html#boost_overload.tutorial.the_make_overload_utility" title="The make_overload utility">The
+ make_overload utility</a>
+</h3></div></div></div>
+<p>
+ <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a> provides an utility
+ named <a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload" title="Generative function make_overload"><code class="computeroutput"><span class="identifier">make_overload</span></code></a> to create an <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a> object on the fly without
+ the need to specify the <a class="link" href="design_and_definitions.html#boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects" title="Call Signatures and Callable Objects">call
+ signature</a> of each callable object passed as argument. A limitation
+ of the <a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload" title="Generative function make_overload"><code class="computeroutput"><span class="identifier">make_overload</span></code></a> utility is that it
+ can handle only monomorphic callable objects.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ In order to utilize the <a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload" title="Generative function make_overload"><code class="computeroutput"><span class="identifier">make_overload</span></code></a> utility you need
+ to include the header file <a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp" title="&lt;boost/overload/make_overload.hpp&gt;"><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">/</span><span class="identifier">make_overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code></a>
+ </p></td></tr>
+</table></div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ <a class="link" href="references.html#boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload" title="Generative function make_overload"><code class="computeroutput"><span class="identifier">make_overload</span></code></a> utility implementation
+ depends on Boost.TypeOf
+ </p></td></tr>
+</table></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">hash</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="keyword">struct</span><span class="special">/</span><span class="identifier">adapt_struct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">adapt_struct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">transformation</span><span class="special">/</span><span class="identifier">transform</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">transform</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">iteration</span><span class="special">/</span><span class="identifier">for_each</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">for_each</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">// You need this header file for the make_overload utility</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">/</span><span class="identifier">make_overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">;</span>
+
+
+<span class="comment">// A sample struct</span>
+<span class="keyword">struct</span> <span class="identifier">Person</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">name</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">age</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">student</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="comment">// Make the Person struct a Boost.Fusion sequence</span>
+<span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
+ <span class="identifier">Person</span><span class="special">,</span>
+ <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">name</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">age</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">bool</span><span class="special">,</span> <span class="identifier">student</span><span class="special">)</span>
+<span class="special">)</span>
+
+<span class="comment">// Creates a hash value by combining hash values</span>
+<span class="keyword">class</span> <span class="identifier">hash_combine</span>
+<span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">hash_combine</span><span class="special">(</span><span class="identifier">size_t</span><span class="special">&amp;</span> <span class="identifier">_seed</span><span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">m_seed</span><span class="special">(</span><span class="identifier">_seed</span><span class="special">)</span>
+ <span class="special">{}</span>
+
+ <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span> <span class="identifier">size_t</span> <span class="identifier">hv</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="identifier">m_seed</span> <span class="special">^=</span> <span class="identifier">hv</span> <span class="special">+</span> <span class="number">0x9e3779b9</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">m_seed</span> <span class="special">&lt;&lt;</span> <span class="number">6</span><span class="special">)</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">m_seed</span> <span class="special">&gt;&gt;</span> <span class="number">2</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="comment">// boost::fusion::for_each needs a const reference function object</span>
+ <span class="keyword">volatile</span> <span class="identifier">size_t</span><span class="special">&amp;</span> <span class="identifier">m_seed</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="comment">// It will be used to generate a hash value for each field of a Person object</span>
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">size_t</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="special">),</span>
+ <span class="identifier">size_t</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span>
+ <span class="identifier">size_t</span> <span class="special">(</span><span class="keyword">bool</span> <span class="special">)&gt;</span>
+ <span class="identifier">person_field_hash_function_type</span><span class="special">;</span>
+
+<span class="comment">// Returns a hash value for an object of Person type</span>
+<span class="identifier">size_t</span> <span class="identifier">hash</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Person</span> <span class="special">&amp;</span> <span class="identifier">person</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">person_field_hash_function_type</span> <span class="special">&amp;</span> <span class="identifier">hf</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">;</span>
+
+ <span class="identifier">size_t</span> <span class="identifier">seed</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="identifier">hash_combine</span> <span class="identifier">hc</span><span class="special">(</span><span class="identifier">seed</span><span class="special">);</span>
+ <span class="identifier">for_each</span><span class="special">(</span> <span class="identifier">transform</span><span class="special">(</span><span class="identifier">person</span><span class="special">,</span> <span class="identifier">hf</span><span class="special">),</span> <span class="identifier">hc</span> <span class="special">);</span>
+ <span class="keyword">return</span> <span class="identifier">seed</span><span class="special">;</span>
+<span class="special">}</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">Person</span> <span class="identifier">Anna</span> <span class="special">=</span> <span class="special">{</span><span class="string">"Anna Rossi"</span><span class="special">,</span> <span class="number">25</span><span class="special">,</span> <span class="keyword">false</span><span class="special">};</span>
+
+ <span class="comment">// We utilize make_overload to create an overload object on the fly</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">hv</span> <span class="special">=</span>
+ <span class="identifier">hash</span><span class="special">(</span> <span class="identifier">Anna</span><span class="special">,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_overload</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;(),</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;(),</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">&gt;()</span> <span class="special">)</span> <span class="special">);</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">Anna</span><span class="special">.</span><span class="identifier">name</span> <span class="special">&lt;&lt;</span> <span class="string">" hash value: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">hv</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.tutorial.helper_methods"></a><a class="link" href="tutorial.html#boost_overload.tutorial.helper_methods" title="Helper methods">Helper methods</a>
+</h3></div></div></div>
+<p>
+ There are some helper methods provided by the template class overload and
+ that mimic the ones offered by the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
+ template class:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ we have the <a class="link" href="references.html#ref_overload_empty_S"><code class="computeroutput"><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a> method that tell us if it
+ is set an object target related to the specified call signature;
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_empty_all"><code class="computeroutput"><span class="identifier">empty_all</span></code></a>
+ method that tell us if all object targets are empty;
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_empty_any"><code class="computeroutput"><span class="identifier">empty_any</span></code></a>
+ method that tell us if any object targets are empty
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_empty_none"><code class="computeroutput"><span class="identifier">empty_none</span></code></a>
+ method that returns true if no object target is empty;
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_get_S"><code class="computeroutput"><span class="identifier">get</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a> method return a (const) reference
+ to the embedded object of type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code>;
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_clear_S"><code class="computeroutput"><span class="identifier">clear</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code></a> method clears the objecttarget
+ related to the specified signature;
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_clear_all"><code class="computeroutput"><span class="identifier">clear_all</span></code></a>
+ method that clears all the object targets.
+ </li>
+<li class="listitem">
+ the <a class="link" href="references.html#ref_overload_swap"><code class="computeroutput"><span class="identifier">swap</span></code></a>
+ method that accepts overload objects of the same type of <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code> its action is to exchange the object
+ targets for each pair of embedded <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
+ objects with the same call signature;
+ </li>
+<li class="listitem">
+ finally we have the <a class="link" href="references.html#ref_overload_swap_function"><code class="computeroutput"><span class="identifier">swap_function</span></code></a> method that takes
+ only callable entities of type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code> where <code class="computeroutput"><span class="identifier">Signature</span></code>
+ has to be a supported signature of the given instantiation of the template
+ class <a class="link" href="references.html#boost_overload.references.boost_overload_hpp.class_template_overload" title="Class template overload"><code class="computeroutput"><span class="identifier">overload</span></code></a>; its action is to swap
+ the object target of the passed <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code> instance with the object target of
+ the embedded <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">Signature</span><span class="special">&gt;</span></code>
+ object.
+ </li>
+</ul></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">zoo</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">int</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">(</span><span class="number">2</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">));</span> <span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">zoo2</span><span class="special">(</span><span class="keyword">double</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">int</span> <span class="identifier">foo2</span><span class="special">(</span><span class="identifier">T</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">-(</span><span class="keyword">int</span><span class="special">)(</span><span class="number">2</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">));</span> <span class="special">}</span>
+
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">sig1</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">);</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">sig2</span> <span class="special">(</span><span class="keyword">double</span> <span class="special">);</span>
+<span class="keyword">typedef</span> <span class="keyword">int</span> <span class="identifier">sig3</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">);</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="comment">// test if a object target is valid</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">,</span> <span class="identifier">sig2</span><span class="special">,</span> <span class="identifier">sig3</span><span class="special">&gt;</span><span class="identifier">f</span><span class="special">;</span>
+ <span class="comment">// all object targets are empty</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_any</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="comment">// only the first object target is set</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_any</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;(&amp;</span><span class="identifier">zoo</span><span class="special">);</span>
+ <span class="comment">// only the last object target is not set</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_any</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="comment">// no object target is empty</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_none</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">clear</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;();</span>
+ <span class="comment">// all object targets set but the second one</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_any</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="special">!</span><span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">clear_all</span><span class="special">();</span>
+ <span class="comment">// all object targets are empty again</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_all</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty_any</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;()</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;()</span> <span class="special">);</span>
+
+
+ <span class="comment">// swapping</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;(&amp;</span><span class="identifier">foo</span><span class="special">).</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;(&amp;</span><span class="identifier">zoo</span><span class="special">).</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;(&amp;</span><span class="identifier">foo</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;</span> <span class="identifier">h</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;();</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">h</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">h</span> <span class="special">=</span> <span class="special">&amp;</span><span class="identifier">zoo2</span><span class="special">;</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">h</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo2</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">swap_function</span><span class="special">(</span><span class="identifier">h</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo2</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">h</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;(</span><span class="identifier">h</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">,</span> <span class="identifier">sig2</span><span class="special">,</span> <span class="identifier">sig3</span><span class="special">&gt;</span> <span class="identifier">g</span><span class="special">;</span>
+ <span class="identifier">g</span><span class="special">.</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig1</span><span class="special">&gt;(&amp;</span><span class="identifier">foo2</span><span class="special">).</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig2</span><span class="special">&gt;(&amp;</span><span class="identifier">zoo2</span><span class="special">).</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">sig3</span><span class="special">&gt;(&amp;</span><span class="identifier">foo2</span><span class="special">);</span>
+ <span class="identifier">f</span><span class="special">.</span><span class="identifier">swap</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo2</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo2</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">f</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo2</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">g</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">g</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">zoo</span><span class="special">(</span><span class="number">1.0</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">g</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">foo</span><span class="special">(</span><span class="char">'x'</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ For any helper method that supports the call signature syntax there is
+ an equivalent method that supports the index syntax.
+ </p></td></tr>
+</table></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="use_case.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/boost_overload/use_case.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/boost_overload/use_case.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,96 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Use case</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="up" href="../index.html" title="Boost.Overload 0.4.0">
+<link rel="prev" href="tutorial.html" title="Tutorial">
+<link rel="next" href="advanced_features.html" title="Advanced features">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="advanced_features.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_overload.use_case"></a><a class="link" href="use_case.html" title="Use case">Use case</a>
+</h2></div></div></div>
+<div class="toc"><dl><dt><span class="section"><a href="use_case.html#boost_overload.use_case.a_boost_variant_visitor">A Boost.Variant
+ visitor</a></span></dt></dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_overload.use_case.a_boost_variant_visitor"></a><a class="link" href="use_case.html#boost_overload.use_case.a_boost_variant_visitor" title="A Boost.Variant visitor">A Boost.Variant
+ visitor</a>
+</h3></div></div></div>
+<p>
+ In the following example you will see <a class="link" href="../index.html" title="Boost.Overload 0.4.0">Boost.Overload</a>
+ used to design an overloaded visitor utility template class that let us create
+ a dynamic visitor for a variant object.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">variant</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">lightweight_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">overload</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Overload</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">R</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">detail</span><span class="special">::</span><span class="identifier">static_visitor_default_return</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">overloaded_visitor</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">Overload</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">R</span> <span class="identifier">result_type</span><span class="special">;</span>
+<span class="special">};</span>
+
+
+
+<span class="keyword">int</span> <span class="identifier">apply_to_int</span><span class="special">(</span><span class="keyword">int</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">apply_to_string</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span>
+<span class="special">}</span>
+
+
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">overload</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span> <span class="special">),</span> <span class="keyword">int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="special">)&gt;</span> <span class="identifier">overload_type</span><span class="special">;</span>
+
+<span class="keyword">typedef</span> <span class="identifier">overloaded_visitor</span><span class="special">&lt;</span><span class="identifier">overload_type</span><span class="special">,</span> <span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">visitor_type</span><span class="special">;</span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">variant</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&gt;</span> <span class="identifier">u</span><span class="special">(</span><span class="string">"hello world"</span><span class="special">);</span>
+
+ <span class="identifier">visitor_type</span> <span class="identifier">my_visitor</span><span class="special">;</span>
+ <span class="identifier">my_visitor</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span> <span class="special">&amp;</span><span class="identifier">apply_to_int</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">apply_to_string</span> <span class="special">);</span>
+
+ <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">apply_visitor</span><span class="special">(</span> <span class="identifier">my_visitor</span><span class="special">,</span> <span class="identifier">u</span> <span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="number">2</span> <span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="advanced_features.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Modified: sandbox/overload/trunk/libs/overload/docs/html/boostbook.css
==============================================================================
--- sandbox/overload/trunk/libs/overload/docs/html/boostbook.css (original)
+++ sandbox/overload/trunk/libs/overload/docs/html/boostbook.css 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -10,7 +10,7 @@
     Body defaults
 =============================================================================*/
 
- body
+ body
     {
         margin: 1em;
         font-family: sans-serif;
@@ -20,10 +20,10 @@
     Paragraphs
 =============================================================================*/
 
- p
+ p
     {
         text-align: left;
- font-size: 10pt;
+ font-size: 10pt;
         line-height: 1.15;
     }
 
@@ -39,12 +39,12 @@
 
     pre.synopsis
     {
- font-size: 90%;
+ font-size: 9pt;
         margin: 1pc 4% 0pc 4%;
         padding: 0.5pc 0.5pc 0.5pc 0.5pc;
     }
 
- .programlisting,
+ .programlisting,
     .screen
     {
         font-size: 9pt;
@@ -54,7 +54,7 @@
     }
 
     /* Program listings in tables don't get borders */
- td .programlisting,
+ td .programlisting,
     td .screen
     {
         margin: 0pc 0pc 0pc 0pc;
@@ -65,28 +65,28 @@
     Headings
 =============================================================================*/
 
- h1, h2, h3, h4, h5, h6
- {
- text-align: left;
+ h1, h2, h3, h4, h5, h6
+ {
+ text-align: left;
         margin: 1em 0em 0.5em 0em;
         font-weight: bold;
     }
 
- h1 { font: 140% }
- h2 { font: bold 140% }
- h3 { font: bold 130% }
- h4 { font: bold 120% }
- h5 { font: italic 110% }
- h6 { font: italic 100% }
+ h1 { font-size: 140%; }
+ h2 { font-weight: bold; font-size: 140%; }
+ h3 { font-weight: bold; font-size: 130%; }
+ h4 { font-weight: bold; font-size: 120%; }
+ h5 { font-weight: normal; font-style: italic; font-size: 110%; }
+ h6 { font-weight: normal; font-style: italic; font-size: 100%; }
 
     /* Top page titles */
- title,
- h1.title,
+ title,
+ h1.title,
     h2.title
- h3.title,
- h4.title,
- h5.title,
- h6.title,
+ h3.title,
+ h4.title,
+ h5.title,
+ h6.title,
     .refentrytitle
     {
         font-weight: bold;
@@ -100,7 +100,7 @@
     h5.title { font-size: 110% }
     h6.title { font-size: 100% }
 
- .section h1
+ .section h1
     {
         margin: 0em 0em 0.5em 0em;
         font-size: 140%;
@@ -116,17 +116,18 @@
     h1 tt.computeroutput { font-size: 140% }
     h2 tt.computeroutput { font-size: 140% }
     h3 tt.computeroutput { font-size: 130% }
- h4 tt.computeroutput { font-size: 120% }
- h5 tt.computeroutput { font-size: 110% }
- h6 tt.computeroutput { font-size: 100% }
+ h4 tt.computeroutput { font-size: 130% }
+ h5 tt.computeroutput { font-size: 130% }
+ h6 tt.computeroutput { font-size: 130% }
+
 
 /*=============================================================================
     Author
 =============================================================================*/
 
- h3.author
- {
- font-size: 100%
+ h3.author
+ {
+ font-size: 100%
     }
 
 /*=============================================================================
@@ -138,15 +139,15 @@
         font-size: 10pt;
         line-height: 1.3;
     }
-
+
     /* Unordered lists */
- ul
+ ul
     {
         text-align: left;
     }
-
+
     /* Ordered lists */
- ol
+ ol
     {
         text-align: left;
     }
@@ -159,7 +160,7 @@
     {
         text-decoration: none; /* no underline */
     }
-
+
     a:hover
     {
         text-decoration: underline;
@@ -173,18 +174,34 @@
     {
         text-align: right;
     }
-
+
     .spirit-nav a
     {
+ color: white;
         padding-left: 0.5em;
     }
-
+
     .spirit-nav img
     {
         border-width: 0px;
     }
 
 /*=============================================================================
+ Copyright footer
+=============================================================================*/
+ .copyright-footer
+ {
+ text-align: right;
+ font-size: 70%;
+ }
+
+ .copyright-footer p
+ {
+ text-align: right;
+ font-size: 80%;
+ }
+
+/*=============================================================================
     Table of contents
 =============================================================================*/
 
@@ -192,44 +209,51 @@
     {
        margin: 1pc 4% 0pc 4%;
        padding: 0.1pc 1pc 0.1pc 1pc;
- font-size: 80%;
+ font-size: 80%;
        line-height: 1.15;
     }
-
+
     .boost-toc
     {
        float: right;
        padding: 0.5pc;
     }
+
+ /* Code on toc */
+ .toc .computeroutput { font-size: 120% }
+
+ /* No margin on nested menus */
+
+ .toc dl dl { margin: 0; }
 
 /*=============================================================================
     Tables
 =============================================================================*/
 
- .table-title,
+ .table-title,
     div.table p.title
     {
         margin-left: 4%;
- padding-right: 0.5em;
+ padding-right: 0.5em;
         padding-left: 0.5em;
     }
-
- .informaltable table,
+
+ .informaltable table,
     .table table
     {
         width: 92%;
         margin-left: 4%;
         margin-right: 4%;
     }
-
- div.informaltable table,
+
+ div.informaltable table,
     div.table table
     {
         padding: 4px;
     }
-
+
     /* Table Cells */
- div.informaltable table tr td,
+ div.informaltable table tr td,
     div.table table tr td
     {
         padding: 0.5em;
@@ -237,7 +261,7 @@
         font-size: 9pt;
     }
 
- div.informaltable table tr th,
+ div.informaltable table tr th,
     div.table table tr th
     {
         padding: 0.5em 0.5em 0.5em 0.5em;
@@ -250,6 +274,7 @@
         width: auto !important;
         margin: 0em !important;
         padding: 0em !important;
+ border: none !important;
     }
     table.simplelist td
     {
@@ -257,6 +282,7 @@
         padding: 0em !important;
         text-align: left !important;
         font-size: 9pt !important;
+ border: none !important;
     }
 
 /*=============================================================================
@@ -276,7 +302,7 @@
         margin: 1pc 4% 0pc 4%;
         padding: 0.5pc 0.5pc 0.5pc 0.5pc;
     }
-
+
     p.blurb img
     {
         padding: 1pt;
@@ -286,6 +312,11 @@
     Variable Lists
 =============================================================================*/
 
+ div.variablelist
+ {
+ margin: 1em 0;
+ }
+
     /* Make the terms in definition lists bold */
     div.variablelist dl dt,
     span.term
@@ -354,13 +385,33 @@
 
     @media screen
     {
+ body {
+ background-color: #FFFFFF;
+ color: #000000;
+ }
+
+ /* Syntax Highlighting */
+ .keyword { color: #0000AA; }
+ .identifier { color: #000000; }
+ .special { color: #707070; }
+ .preprocessor { color: #402080; }
+ .char { color: teal; }
+ .comment { color: #800000; }
+ .string { color: teal; }
+ .number { color: teal; }
+ .white_bkd { background-color: #FFFFFF; }
+ .dk_grey_bkd { background-color: #999999; }
+
     /* Links */
- a
+ a, a .keyword, a .identifier, a .special, a .preprocessor
+ a .char, a .comment, a .string, a .number
         {
             color: #005a9c;
         }
-
- a:visited
+
+ a:visited, a:visited .keyword, a:visited .identifier,
+ a:visited .special, a:visited .preprocessor a:visited .char,
+ a:visited .comment, a:visited .string, a:visited .number
         {
             color: #9c5a9c;
         }
@@ -372,49 +423,37 @@
             text-decoration: none; /* no underline */
             color: #000000;
         }
-
- /* Syntax Highlighting */
- .keyword { color: #0000AA; }
- .identifier { color: #000000; }
- .special { color: #707070; }
- .preprocessor { color: #402080; }
- .char { color: teal; }
- .comment { color: #800000; }
- .string { color: teal; }
- .number { color: teal; }
- .white_bkd { background-color: #FFFFFF; }
- .dk_grey_bkd { background-color: #999999; }
-
+
     /* Copyright, Legal Notice */
- .copyright
- {
- color: #666666;
- font-size: small;
+ .copyright
+ {
+ color: #666666;
+ font-size: small;
         }
-
+
         div div.legalnotice p
         {
             color: #666666;
         }
-
+
     /* Program listing */
         pre.synopsis
         {
             border: 1px solid #DCDCDC;
         }
-
- .programlisting,
+
+ .programlisting,
         .screen
         {
             border: 1px solid #DCDCDC;
         }
-
- td .programlisting,
+
+ td .programlisting,
         td .screen
         {
             border: 0px solid #DCDCDC;
         }
-
+
     /* Blurbs */
         div.note,
         div.tip,
@@ -425,39 +464,39 @@
         {
             border: 1px solid #DCDCDC;
         }
-
+
     /* Table of contents */
         .toc
         {
             border: 1px solid #DCDCDC;
         }
-
+
     /* Tables */
- div.informaltable table tr td,
+ div.informaltable table tr td,
         div.table table tr td
         {
             border: 1px solid #DCDCDC;
         }
-
- div.informaltable table tr th,
+
+ div.informaltable table tr th,
         div.table table tr th
         {
             background-color: #F0F0F0;
             border: 1px solid #DCDCDC;
         }
 
- table.simplelist tr td
+ .copyright-footer
         {
- border: none !important;
+ color: #8F8F8F;
         }
-
+
     /* Misc */
         span.highlight
         {
             color: #00A000;
         }
     }
-
+
     @media print
     {
     /* Links */
@@ -465,56 +504,56 @@
         {
             color: black;
         }
-
+
         a:visited
         {
             color: black;
         }
-
+
         .spirit-nav
         {
             display: none;
         }
-
+
     /* Program listing */
         pre.synopsis
         {
             border: 1px solid gray;
         }
-
- .programlisting,
+
+ .programlisting,
         .screen
         {
             border: 1px solid gray;
         }
-
- td .programlisting,
+
+ td .programlisting,
         td .screen
         {
             border: 0px solid #DCDCDC;
         }
-
+
     /* Table of contents */
         .toc
         {
             border: 1px solid gray;
         }
-
- .informaltable table,
+
+ .informaltable table,
         .table table
         {
             border: 1px solid gray;
             border-collapse: collapse;
         }
-
+
     /* Tables */
- div.informaltable table tr td,
+ div.informaltable table tr td,
         div.table table tr td
         {
             border: 1px solid gray;
         }
-
- div.informaltable table tr th,
+
+ div.informaltable table tr th,
         div.table table tr th
         {
             border: 1px solid gray;
@@ -524,7 +563,7 @@
         {
             border: none !important;
         }
-
+
     /* Misc */
         span.highlight
         {
@@ -539,4 +578,34 @@
     span.inlinemediaobject img
     {
         vertical-align: middle;
- }
\ No newline at end of file
+ }
+
+/*==============================================================================
+ Super and Subscript: style so that line spacing isn't effected, see
+ http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341
+==============================================================================*/
+
+sup,
+sub {
+ height: 0;
+ line-height: 1;
+ vertical-align: baseline;
+ position: relative;
+
+}
+
+/* For internet explorer: */
+
+* html sup,
+* html sub {
+ vertical-align: bottom;
+}
+
+sup {
+ bottom: 1ex;
+}
+
+sub {
+ top: .5ex;
+}
+

Added: sandbox/overload/trunk/libs/overload/docs/html/docutils.css
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/docutils.css 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,275 @@
+/*
+:Author: David Goodger
+:Contact: goodger_at_[hidden]
+:Date: $Date: 2007-11-25 14:34:32 -0500 (Sun, 25 Nov 2007) $
+:Revision: $Revision: 41371 $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+ border: 0 }
+
+table.borderless td, table.borderless th {
+ /* Override padding for "table.docutils td" with "! important".
+ The right padding separates the table cells. */
+ padding: 0 0.5em 0 0 ! important }
+
+.first {
+ /* Override more specific margin styles with "! important". */
+ margin-top: 0 ! important }
+
+.last, .with-subtitle {
+ margin-bottom: 0 ! important }
+
+.hidden {
+ display: none }
+
+a.toc-backref {
+ text-decoration: none ;
+ color: black }
+
+blockquote.epigraph {
+ margin: 2em 5em ; }
+
+dl.docutils dd {
+ margin-bottom: 0.5em }
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+ font-weight: bold }
+*/
+
+div.abstract {
+ margin: 2em 5em }
+
+div.abstract p.topic-title {
+ font-weight: bold ;
+ text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+ margin: 2em ;
+ border: medium outset ;
+ padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+ font-weight: bold ;
+ font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+ color: red ;
+ font-weight: bold ;
+ font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+ compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+ margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+ margin-top: 0.5em }
+*/
+
+div.dedication {
+ margin: 2em 5em ;
+ text-align: center ;
+ font-style: italic }
+
+div.dedication p.topic-title {
+ font-weight: bold ;
+ font-style: normal }
+
+div.figure {
+ margin-left: 2em ;
+ margin-right: 2em }
+
+div.footer, div.header {
+ clear: both;
+ font-size: smaller }
+
+div.line-block {
+ display: block ;
+ margin-top: 1em ;
+ margin-bottom: 1em }
+
+div.line-block div.line-block {
+ margin-top: 0 ;
+ margin-bottom: 0 ;
+ margin-left: 1.5em }
+
+div.sidebar {
+ margin-left: 1em ;
+ border: medium outset ;
+ padding: 1em ;
+ background-color: #ffffee ;
+ width: 40% ;
+ float: right ;
+ clear: right }
+
+div.sidebar p.rubric {
+ font-family: sans-serif ;
+ font-size: medium }
+
+div.system-messages {
+ margin: 5em }
+
+div.system-messages h1 {
+ color: red }
+
+div.system-message {
+ border: medium outset ;
+ padding: 1em }
+
+div.system-message p.system-message-title {
+ color: red ;
+ font-weight: bold }
+
+div.topic {
+ margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+ margin-top: 0.4em }
+
+h1.title {
+ text-align: center }
+
+h2.subtitle {
+ text-align: center }
+
+hr.docutils {
+ width: 75% }
+
+img.align-left {
+ clear: left }
+
+img.align-right {
+ clear: right }
+
+ol.simple, ul.simple {
+ margin-bottom: 1em }
+
+ol.arabic {
+ list-style: decimal }
+
+ol.loweralpha {
+ list-style: lower-alpha }
+
+ol.upperalpha {
+ list-style: upper-alpha }
+
+ol.lowerroman {
+ list-style: lower-roman }
+
+ol.upperroman {
+ list-style: upper-roman }
+
+p.attribution {
+ text-align: right ;
+ margin-left: 50% }
+
+p.caption {
+ font-style: italic }
+
+p.credits {
+ font-style: italic ;
+ font-size: smaller }
+
+p.label {
+ white-space: nowrap }
+
+p.rubric {
+ font-weight: bold ;
+ font-size: larger ;
+ color: maroon ;
+ text-align: center }
+
+p.sidebar-title {
+ font-family: sans-serif ;
+ font-weight: bold ;
+ font-size: larger }
+
+p.sidebar-subtitle {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+p.topic-title {
+ font-weight: bold }
+
+pre.address {
+ margin-bottom: 0 ;
+ margin-top: 0 ;
+ font-family: serif ;
+ font-size: 100% }
+
+pre.literal-block, pre.doctest-block {
+ margin-left: 2em ;
+ margin-right: 2em }
+
+span.classifier {
+ font-family: sans-serif ;
+ font-style: oblique }
+
+span.classifier-delimiter {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+span.interpreted {
+ font-family: sans-serif }
+
+span.option {
+ white-space: nowrap }
+
+span.pre {
+ white-space: pre }
+
+span.problematic {
+ color: red }
+
+span.section-subtitle {
+ /* font-size relative to parent (h1..h6 element) */
+ font-size: 80% }
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px }
+
+table.docinfo {
+ margin: 2em 4em }
+
+table.docutils {
+ margin-top: 0.5em ;
+ margin-bottom: 0.5em }
+
+table.footnote {
+ border-left: solid 1px black;
+ margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+ padding-left: 0.5em ;
+ padding-right: 0.5em ;
+ vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+ font-weight: bold ;
+ text-align: left ;
+ white-space: nowrap ;
+ padding-left: 0 }
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+ font-size: 100% }
+
+ul.auto-toc {
+ list-style-type: none }

Added: sandbox/overload/trunk/libs/overload/docs/html/index.html
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/index.html 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,99 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Boost.Overload 0.4.0</title>
+<link rel="stylesheet" href="boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="index.html" title="Boost.Overload 0.4.0">
+<link rel="next" href="boost_overload/getting_started.html" title="Getting Started">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_overload/getting_started.html"><img src="images/next.png" alt="Next"></a></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="boost_overload"></a>Boost.Overload 0.4.0</h2></div>
+<div><div class="authorgroup"><div class="author"><h3 class="author">
+<span class="firstname">Marco</span> <span class="surname">Cecchetti</span>
+</h3></div></div></div>
+<div><p class="copyright">Copyright &#169; 2007-2012 Marco Cecchetti, Dean Michael Berris</p></div>
+<div><div class="legalnotice">
+<a name="boost_overload.legal"></a><p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Getting Started</span></dt>
+<dd><dl>
+<dt><span class="section">Overview</span></dt>
+<dt><span class="section"><a href="boost_overload/getting_started.html#boost_overload.getting_started.installation_and_configuration">Installation
+ and configuration</a></span></dt>
+</dl></dd>
+<dt><span class="section">Tutorial</span></dt>
+<dd><dl>
+<dt><span class="section">Basic usage</span></dt>
+<dt><span class="section"><a href="boost_overload/tutorial.html#boost_overload.tutorial.backward_compatibility__boost__overload_is_a_boost__function">Backward
+ compatibility: boost::overload is a boost::function</a></span></dt>
+<dt><span class="section"><a href="boost_overload/tutorial.html#boost_overload.tutorial.supported_types_of_callable_entities">Supported
+ types of callable entities</a></span></dt>
+<dt><span class="section"><a href="boost_overload/tutorial.html#boost_overload.tutorial.the_call_signature_based_syntax">The
+ call signature based syntax</a></span></dt>
+<dt><span class="section"><a href="boost_overload/tutorial.html#boost_overload.tutorial.the_index_based_syntax">The index
+ based syntax</a></span></dt>
+<dt><span class="section"><a href="boost_overload/tutorial.html#boost_overload.tutorial.the_make_overload_utility">The
+ make_overload utility</a></span></dt>
+<dt><span class="section">Helper methods</span></dt>
+</dl></dd>
+<dt><span class="section">Use case</span></dt>
+<dd><dl><dt><span class="section"><a href="boost_overload/use_case.html#boost_overload.use_case.a_boost_variant_visitor">A Boost.Variant
+ visitor</a></span></dt></dl></dd>
+<dt><span class="section">Advanced features</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="boost_overload/advanced_features.html#boost_overload.advanced_features.the_set_for_each_shared_signature_method">The
+ set_for_each_shared_signature method</a></span></dt>
+<dt><span class="section"><a href="boost_overload/advanced_features.html#boost_overload.advanced_features.boost_resultof_and_boost_lambda_support">Boost.ResultOf
+ and Boost.Lambda support</a></span></dt>
+<dt><span class="section"><a href="boost_overload/advanced_features.html#boost_overload.advanced_features.a_special_variant_of_the_set_signature__method">A
+ special variant of the set&lt;Signature&gt; method</a></span></dt>
+<dt><span class="section">Type Traits</span></dt>
+</dl></dd>
+<dt><span class="section">Design and Definitions</span></dt>
+<dd><dl>
+<dt><span class="section">Design</span></dt>
+<dt><span class="section">Definitions</span></dt>
+</dl></dd>
+<dt><span class="section">References</span></dt>
+<dd><dl>
+<dt><span class="section"><boost/overload.hpp></span></dt>
+<dt><span class="section"><boost/overload/make_overload.hpp></span></dt>
+</dl></dd>
+<dt><span class="section">Acknowledgements</span></dt>
+</dl>
+</div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ At present Boost.Overload <span class="bold"><strong>IS NOT</strong></span> a Boost Library
+ </p></td></tr>
+</table></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: March 18, 2012 at 15:00 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_overload/getting_started.html"><img src="images/next.png" alt="Next"></a></div>
+</body>
+</html>

Added: sandbox/overload/trunk/libs/overload/docs/html/minimal.css
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/minimal.css 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,29 @@
+/*
+
+ © Copyright Beman Dawes, 2007
+
+ Distributed under the Boost Software License, Version 1.0.
+ See www.boost.org/LICENSE_1_0.txt
+
+*/
+
+/*******************************************************************************
+ Body
+*******************************************************************************/
+
+body { font-family: sans-serif; margin: 1em; }
+
+/*******************************************************************************
+ Table
+*******************************************************************************/
+
+table { margin: 0.5em; }
+
+/*******************************************************************************
+ Font sizes
+*******************************************************************************/
+
+p, td, li, blockquote { font-size: 10pt; }
+pre { font-size: 9pt; }
+
+/*** end ***/
\ No newline at end of file

Added: sandbox/overload/trunk/libs/overload/docs/html/reference.css
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/reference.css 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,11 @@
+/*============================================================================
+ Copyright 2003-2004 Douglas Gregor
+ Distributed under the Boost Software License, Version 1.0. (See accompany-
+ ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+============================================================================*/
+
+PRE.synopsis {
+ background-color: #e0ffff;
+ border: thin solid blue;
+ padding: 1em
+}
\ No newline at end of file

Added: sandbox/overload/trunk/libs/overload/docs/html/standalone_HTML.manifest
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/html/standalone_HTML.manifest 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,8 @@
+index.html
+boost_overload/getting_started.html
+boost_overload/tutorial.html
+boost_overload/use_case.html
+boost_overload/advanced_features.html
+boost_overload/design_and_definitions.html
+boost_overload/references.html
+boost_overload/acknowledgements.html

Deleted: sandbox/overload/trunk/libs/overload/docs/overload.qbk
==============================================================================
--- sandbox/overload/trunk/libs/overload/docs/overload.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,237 +0,0 @@
-[article Boost.Overload
- [quickbook 1.4]
- [version 0.3.0]
- [authors [Cecchetti, Marco], [Berris, Dean Michael]]
- [copyright 2007 Marco Cecchetti, Dean Michael Berris]
- [purpose Multi Signature Overloaded Function Set]
- [license
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- [@http://www.boost.org/LICENSE_1_0.txt])
- ]
- [last-revision $Date: 2007/11/05 15:00 $]
-]
-
-[/ Boost Overload Document Version 0.3.0 ]
-
-
-[def __empty_line__ \n\n ]
-
-[def __overload__ [link overload overload]]
-[def __set__ [link set set]]
-[def __set_sig__ [link set_sig set<signature> ]]
-[def __empty_sig__ [link empty_sig empty<signature_type> ]]
-[def __empty_all__ [link empty_all empty_all ]]
-[def __get_sig__ [link get_sig get<signature_type> ]]
-[def __clear_sig__ [link clear_sig clear<signature_type> ]]
-[def __clear_all__ [link clear_all clear_all ]]
-[def __swap_func__ [link swap_func swap_function ]]
-
-[warning At present Boost.Overload *IS NOT* a Boost Library ]
-
-[section:intro Introduction]
-
-There are cases where you might want to have a function object which
-accepts different function overloads mapped to different implementations.
-There are also some cases where you have the same function object be
-able to accept different signatures so that it may be used in different
-contexts using different signatures. As of the moment, Boost.Function is
-monomorphic -- which means it can only hold one reference to a function
-conforming to just one signature.
-
-Boost.Overload is a multi-signature overloaded Boost.Function wrapper,
-which wraps multiple Boost.Function objects of different signatures as a
-single multi-signature overloaded function wrapper.
-
-[endsect]
-
-[section:overview Overview]
-
-Boost.Function already supports wrapping function objects, member
-function pointers, and function pointers in general. By itself,
-Boost.Function is already powerful and already useful enough in situations
-where you want to be able to pass around generic function objects.
-The only limitation of Boost.Function is that you can only wrap one
-function with one instance of the wrapper, and only functions or function
-objects that all have the same signatures. This becomes a problem in
-many settings where an overloaded function set is required.
-
-Boost.Overload allows this functionality of supporting multiple signatures
-by wrapping multiple Boost.Function objects in a single object that
-overloads the function operator to support the various overloads defined.
-This allows us to map many functions to a single overload instance,
-provided that these functions have a signature that the overload instance
-supports. To illustrate the usage of the Boost.Overload library, the
-following code snippet is provided:
-
- #include <boost/overload.hpp>
-
- int foo(int a) { return a + 1; };
- long bar(int a, int b) { return a + b; };
-
- int main(int argc, char * argv[]) {
- boost::overload<int(int), long(int, int)> functions;
- functions.set(&foo);
- functions.set(&bar);
-
- assert(functions(1) == 2);
- assert(functions(2, 3) == 5L);
- return 0;
- }
-
-In the above example we have two functions 'foo' and 'bar', both having
-different signatures and return types. This illustrates the powerful
-features which Boost.Overload allows us to exploit: compile-time function
-argument deduction and registration, and static function dispatch using
-function overload type deduction.
-
-[endsect]
-
-
-[include tutorial.qbk]
-
-
-[section:design Design]
-
-The library is succinctly implemented in one header file requiring only
-that Boost.Function be available. This library also requires the Boost.PP
-(Preprocessor Programming) library if in case you don't want to get the
-preprocessed header file. The library is configured by default to handle
-overloads with 10 unique signatures and can be configured to support more
-by changing the BOOST_OVERLOAD_LIMIT macro when building the application that
-uses Boost.Overload. There are a few concepts documented below which defines
-the terms and details of the implementation.
-
-[note `BOOST_OVERLOAD_LIMIT` by default is set to 10. This means the
-Boost.Overload template by default can handle 10 unique signatures to provide
-as function overloads.]
-
-[endsect]
-
-[section:concepts Concepts]
-
-[section:poly_objs Polymorphic Function Objects]
-
-Polymorphic Function Objects are objects which have dynamic implementations
-or overloads to the function operator. Typical Polymorphic Function Objects
-usually imply run-time polymorphism, when a reference to a base type
-instance is registered to the Overload Set -- and the actual implementation
-depends on the type of the object being referred to by the given reference.
-
-A Function Object is polymorphic if:
-
-* The base type used to refer to the Function Object is virtual.
-__empty_line__
-
-* The type of the Function Object referred to is derived from the base type.
-__empty_line__
-
-* The implementation or actual behavior of the Function Object is
- determined during run-time.
-
-The Overload Set treats a Polymorphic Function Object as a normal function
-object, and the reference to the base type is used to determine at
-run-time which actual implementation is invoked when the Overload Set is
-invoked.
-
-[endsect]
-
-[section:multi_func_obj Multi-Signature Overloaded Function Object]
-
-Multi-Signature Overloaded Function Objects are objects which have two
-or more overloads of the function operator.
-
-A Function Object is a Multi-Signature Overloaded Function Object if
-the Function Object has at least two overloads to the function operator.
-
-The Overload Set treats a Multi-Signature Overloaded Function in a
-special manner, in which it tries to match each unique function operator
-overload defined in the Multi-Signature Overloaded Function Object to the
-supported signature types. This allows multiple overloads of the function
-operator defined in the Multi-Signature Overloaded Function Object to be
-mapped to supported signatures in the Overload Set.
-
-[endsect]
-
-[section:overload_set Overload Set]
-
-An Overload Set is a Multi-Signature Overloaded Function Object which
-wraps different Boost.Function wrappers and exposes multiple overloads to
-the function operator. This allows the Overload Set to expose multiple
-function operator overloads used in turn to perform static dispatch to
-the appropriate supported Boost.Function wrapper. An Overload Set is a
-parametric type (a template) which takes N signature type arguments
--- where N is defined as the BOOST_OVERLOAD_LIMIT, configurable at
-compile time and defaults to 10 -- to define both the signatures of
-the supported function operator overloads as well as the supported
-function object signatures it can encapsulate.
-
-An Overload Set allows the following operations: (assumes overload is
-an instance of Boost.Overload)
-
-* overload.set(F) -- Maps a function object/pointer F to the appropriate
- supported signature. F's signature is deduced at compile time, and the
- static dispatch mechanism allows F to be matched to the appropriately typed
- Boost.Function wrapper. In the case of F being a Multi-Signature Overloaded
- Function Object, all the function operator overloads provided by F will be
- mapped to the appropriately typed Boost.Function wrappers contained by the
- Overload Set.
-__empty_line__
-
-* overload.set<S>(F) -- Maps a function object/pointer F to the
- Boost.Function object which supports the signature S.
-__empty_line__
-
-* overload.set<N>(F) -- Maps a function object/pointer F to the N'th
- signature supported by the Overload Set.
-__empty_line__
-
-* overload.get<S>() -- Returns the actual Boost.Function object which
- supports the signature S from those supported and encapsulated by the
- Overload Set.
-__empty_line__
-
-* overload.empty<S>() -- Returns whether the actual Boost.Function
- object which supports the signature S is not mapped to an existing function.
-
-The Overload Set is default constructable, copyable, and swappable.
-
-[endsect]
-
-[endsect]
-
-[section:implementation Implementation]
-
-TODO: Fill this up!
-
-[endsect]
-
-[section:api_guide API Guide]
-
-TODO: Fill this up! (Use doxygen?)
-
-[endsect]
-
-[section:references References]
-
-TODO: Fill this up!
-
-[endsect]
-
-[section:acknowledgements Acknowledgements]
-
-Thanks go to Joel De Guzman for posting an implementation of a
-minimal overload implementation to the Boost C++ Developer Mailing
-List, and to Douglas Gregor for Boost.Function -- without which all
-this would not have been possible.
-
-[endsect]
-
-[section:credits Credits]
-
-Prepared by Dean Michael Berris mikhailberis_at_[hidden]
-Released under the Boost Software License version 1.0 (http://boost.org/LICENSE_1_0.txt)
-Initial Date Written: October 09, 2007
-
-[endsect]
-

Added: sandbox/overload/trunk/libs/overload/docs/qbk/advanced_features.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/advanced_features.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,105 @@
+[/ Copyright (C) 2012 Marco Cecchetti ]
+[/ Use, modification, and distribution is subject to the Boost Software ]
+[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
+[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
+
+[section Advanced features]
+
+[section The set_for_each_shared_signature method]
+
+The __set_for_each_shared_sig__ method can manage multi-signature
+function objects of class type (i.e. function objects whose `operator()` is
+overloaded or is a template function) and it handles them in a special way. The
+passed function object sets/replaces all the existent object targets related to
+the call signatures supported by both the given instantiation of the template
+class __overload_class__ and the passed function object itself.
+
+[warning Signature deduction of multi-signature function objects is not
+supported with Microsoft Visual C++ 7.1, you have to use the __set_sig__
+method.]
+
+[warning The __set_for_each_shared_sig__ method cannot handle either free
+or member polymorphic functions.]
+
+[section Example - Polymorphic function objects]
+[set_for_each_shared_signature_cpp]
+[endsect]
+
+[warning It is important that you understand that internally for each supported
+signature a new `boost::function` object is generated exactly as you had used
+the __set_sig__ method. Each created `boost::function` instance wraps a
+different copy of the passed multi-signature function object. This behaviour
+can lead to unexpected result if the multi-signature function object has its
+own state. A solution to this issue is to to utilize `boost::ref` for wrapping
+the function object.]
+
+[section Example - A statefull polymorphic function object]
+[statefull_polymorphic_function_object_cpp]
+[endsect]
+
+[endsect]
+
+[section Boost.ResultOf and Boost.Lambda support]
+
+__Boost_Overload__ provides support for __Boost_ResultOf__ and __Boost_Lambda__
+result type deduction. The latter needs to be explicitly enabled by defines the
+macro `BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT`.
+
+[section Example - Boost.ResultOf support]
+[result_of_support_cpp]
+[endsect]
+
+[section Example - Boost.Lambda support]
+[lambda_result_type_support_cpp]
+
+[warning __Boost_Lambda__ result type deduction support does not work with
+MSVC 7.1 and with all Intel compilers prior to version 12.0]
+[endsect]
+
+[endsect]
+
+[section A special variant of the set<Signature> method]
+
+When the explicit call signature of a member function supported by an overload
+object is the non-const qualified version (e.g. as `int (bar*, int )` where
+`bar` is of class type), you need a special variant of the call signature based
+syntax in order to manage the case of a class with two member function
+overloads that differ for the const qualifier only. This is exactly what
+happens in the next example:
+
+[signature_syntax_3_cpp]
+
+[endsect]
+
+[section Type Traits]
+
+For extracting type traits from a template class __overload_class__ the following
+metafunctions are provided:
+
+[table
+[[Metafunction][Description]]
+[[`__tt_extent__<CallWrapperType>::value`]
+ [it provides the amount of signatures supported by a call wrapper type]]
+[[`__tt_signature__<CallWrapperType, N = 0>::type`]
+ [it provides the N-th signature for a call wrapper type
+ (indexing start from zero)]]
+[[`__tt_function__<CallWrapperType, N = 0>::type`]
+ [it provides the type of the N-th boost::function embedded object
+ (indexing start from zero)]]
+[[`__tt_index_of_sig__<CallWrapperType, Signature>::value`]
+ [it provides the index of a signature, and returns -1 if it is not found]]
+[[`__tt_has_signature__<CallWrapperType, Signature>::value`]
+ [utility to discover if a given signature is supported by a call wrapper type]]
+[[`__tt_have_any_shared_sig__<CallWrapperType, Functor>::value`]
+ [utility to discover if a given functor has a signature supported by a call
+ wrapper type]]
+]
+
+These metafunctions live in the namespace `boost::overloads` and work with
+`boost::function` too.
+
+[type_traits_cpp]
+
+[endsect]
+
+[endsect]
\ No newline at end of file

Added: sandbox/overload/trunk/libs/overload/docs/qbk/design_and_definitions.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/design_and_definitions.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,132 @@
+
+[/ Copyright (C) 2012 Marco Cecchetti ]
+[/ Use, modification, and distribution is subject to the Boost Software ]
+[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
+[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
+
+[section Design and Definitions]
+
+[section Design]
+The library is succinctly implemented in one header file requiring only that
+__Boost_Function__, and a small subset of __Boost_TypeTraits__ are available.
+This library also requires the __Boost_Preprocessor__ library
+if in case you don't want to get the preprocessed header file. The library is
+configured by default to handle overloads with 10 unique signatures and can be
+configured to support more by changing the `BOOST_OVERLOAD_LIMIT` macro when
+building the application that uses __Boost_Overload__.
+[endsect]
+
+[section Definitions]
+
+In accordance with the __CPP11__ ISO standard, we provide the following
+definitions.
+
+[section INVOKE expression]
+
+Define `INVOKE (f, t1, t2, ..., tN)` as follows:
+
+* `(t1.*f)(t2, ..., tN)` when `f` is a pointer to a member function of a class
+ `T` and `t1` is an object of type `T` or a reference to an object of type `T`
+ or a reference to an object of a type derived from `T`;
+* `((*t1).*f)(t2, ..., tN)` when `f` is a pointer to a member function of a
+ class `T` and `t1` is not one of the types described in the previous item;
+* `t1.*f` when `N == 1` and `f` is a pointer to member data of a class `T` and
+ `t1` is an object of type `T` or a reference to an object of type `T` or a
+ reference to an object of a type derived from `T`;
+* `(*t1).*f` when `N == 1` and `f` is a pointer to member data of a class `T`
+ and `t1` is not one of the types described in the previous item;
+* `f(t1, t2, ..., tN)` in all other cases.
+
+[endsect]
+
+[section Function Objects]
+
+A /function object type/ is an object type that can be the type of the expression
+preceding the parenthesis in a function call. A /function object/ is an object
+of function object type.
+A function object type that is also of class type must expose a public function
+call operator.
+
+[endsect]
+
+[section Call Signatures and Callable Objects]
+
+A /call signature/ is the name of the expression `R (A1,A2,...,AN)` where
+`R, A1,A2,...,AN` are types. Two call signatures are regarded as /equal/ iff
+the ordered N-upla `A1,A2,...,AN` of one call signature match exactly the
+N-upla of the other one.
+A call signature `S1:=R1 (A1,...,AN)` is /compatible/ with a call signature
+`S2:=R2 (B1,...,BM)` if we have `N == M`, `Bi` is implicitly convertible to
+`Ai` for each `i = 1,...,N` and `R1` is implicitly convertible to `R2`.
+
+A /callable type/ is a function object type or a pointer to member. A /callable
+object/ or /functor/ is an object of callable type.
+
+A callable object `f` supports the call signature `S:=R (A1,A2,...,AN)` if the
+expression `INVOKE(f, a1, a2,...,aN )` where `ai` is of type `Ai` is well
+formed and can be implicitly converted to type `R` or `R` is the `void` type.
+
+In case `f` is a pointer to member function we call `S` an ['explicit call
+signature] of `f`, and we call the call signature `R (A2,...,AN)` ['the implicit
+call signature] of `f`.
+
+Given a call signature `S := R (A1,A2,...,AN)` with `N >= 0`, the type `Ai` is
+said the /i-th argument type/ of `S` and the type `R` is the /result type/ of
+`S`, finally `N` is the arity of `S`.
+If a callable object supports only one call signature these naming conventions
+extend naturally to the callable object.
+
+A /multi-signature/ or /polymorphic callable object/ is a callable object that
+supports two or more different call signatures. For a pointer to member
+function the previous definition apply to the implicit signature.
+
+[endsect]
+
+[section Call Wrappers]
+
+A /call wrapper type/ is a type that holds a callable object and supports a
+call operation that forwards to that object. A /call wrapper/ is an object of
+call wrapper type.
+
+A /target object/ is the callable object held by a call wrapper.
+
+[endsect]
+
+[section Dynamic Function Wrapper]
+
+A type F is a model of /Dynamic Function Wrapper/ with signature S if we have
+that :
+
+* F is a call wrapper type
+* F provides a method to set/replace the object target;
+* F provides a method to check if the object target is empty.
+
+The template classes `boost::function` and `std::function` in C++11 are
+families of models of Dynamic Function Wrapper.
+Any instantiation of the template class __overload_class__ that supports one and only
+one call signature is a model of Dynamic Function Wrapper.
+
+[endsect]
+
+[section Dynamic Overloaded Function Wrapper]
+
+A type `F` is a model of /Dynamic Overloaded Function Wrapper/ supporting the
+signatures `S1, ..., SN` with N >= 2 if for each integer `i` s.t. 1 <= i <= N
+we have that :
+
+* `F` is a call wrapper type for any callable object that supports at least
+ one of the call signatures supported by F; the current accessible callable
+ object related to `Si` is named the object target tied to `Si`; if there
+ is no accessible callable object tied to `Si` the object target related to
+ `Si` is said empty;
+* `F` provides a method to set/replace the object target tied to `Si`;
+* `F` provides a method to check if the object target tied to `Si` is empty
+
+Any instantiation of the template class __overload_class__ that support more than one
+call signature is a model of Dynamic Overloaded Function Wrapper.
+
+[endsect]
+
+[endsect]
+
+[endsect]

Added: sandbox/overload/trunk/libs/overload/docs/qbk/getting_started.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/getting_started.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,49 @@
+
+[/ Copyright (C) 2012 Marco Cecchetti ]
+[/ Use, modification, and distribution is subject to the Boost Software ]
+[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
+[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
+
+
+[section Getting Started]
+
+[section Overview]
+
+__Boost_Function__ already supports wrapping function objects, member function
+pointers, and function pointers in general. By itself, __Boost_Function__ is
+already powerful and already useful enough in situations where you want to be
+able to pass around generic function objects. The only limitation of
+__Boost_Function__ is that you can only wrap one function with one instance of
+the wrapper, and only functions or function objects that all have the same
+signatures. This becomes a problem in many settings where an overloaded
+function set is required.
+__Boost_Overload__ allows this functionality of supporting multiple signatures
+by wrapping multiple __Boost_Function__ objects in a single object that
+overloads the function operator to support the various overloads defined. This
+allows us to map many functions to a single overload instance, provided that
+these functions have a call signature that the __overload_class__ instance supports.
+To illustrate the usage of the __Boost_Overload__ library, the following code
+snippet is provided:
+
+[overview_cpp]
+
+In the above example we have two functions `foo` and `bar`, both having
+different signatures and return types. This illustrates the powerful features
+which __Boost_Overload__ allows us to exploit: compile-time function argument
+deduction and registration, and static function dispatch using function
+overload type deduction.
+
+[endsect]
+
+[section Installation and configuration]
+
+The library is based only on header files, all you have to do in order to
+utilize it is to include the following header file: `boost/overload.hpp` as
+shown in the above example.
+Through the `BOOST_OVERLOAD_LIMITS` configuration macro you can set up the
+maximum number of unique signatures supported by the overload template class.
+The default value is 10 signatures.
+
+[endsect]
+
+[endsect]

Added: sandbox/overload/trunk/libs/overload/docs/qbk/overload.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/overload.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,145 @@
+[article Boost.Overload
+ [quickbook 1.5]
+ [version 0.4.0]
+ [authors [Cecchetti, Marco]]
+ [copyright 2007-2012 Marco Cecchetti, Dean Michael Berris]
+ [/ purpose Multi Signature Overloaded Function Set]
+ [license
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+ ]
+ [/ category Function Objects and Higher-Order Programming]
+ [id boost_overload]
+ [last-revision $Date: 2012/03/18 15:00 $]
+]
+
+[/ Boost Overload Document Version 0.4.0 ]
+
+
+
+[def __overload__ `overload`]
+[def __CPP11__ [@http://www.open-std.org/JTC1/SC22/WG21/ C++11]]
+[def __Boost_Bind__ [@http://www.boost.org/doc/libs/release/libs/bind/bind.html Boost.Bind]]
+[def __Boost_Function__ [@http://www.boost.org/doc/libs/release/doc/html/function.html Boost.Function]]
+[def __Boost_Lambda__ [@http://www.boost.org/doc/libs/release/doc/html/lambda.html Boost.Lambda]]
+[def __Boost_Overload__ [link boost_overload Boost.Overload]]
+[def __Boost_Preprocessor__ [@http://www.boost.org/doc/libs/release/libs/preprocessor/doc/index.html Boost.Preprocessor]]
+[def __Boost_ResultOf__ [@http://www.boost.org/doc/libs/release/libs/utility/utility.htm#result_of Boost.ResultOf]]
+[def __Boost_TypeOf__ [@http://www.boost.org/doc/libs/release/doc/html/typeof.html Boost.TypeOf]]
+[def __Boost_TypeTraits__ [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]]
+
+[def __boost_function_class__ [@http://www.boost.org/doc/libs/release/doc/html/boost/functionN.html `boost::function`]]
+[def __overload_class__ [link boost_overload.references.boost_overload_hpp.class_template_overload __overload__]]
+[def __overload_type_traits__ [link boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_type_traits type traits]]
+[def __overload_ctor_copy_dtor__ [link boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_ctor_copy_dtor construct/copy/destruct ]]
+[def __overload_modifiers__ [link boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_modifiers modifiers]]
+[def __overload_capacity__ [link boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_capacity capacity]]
+[def __overload_function_access__ [link boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_function_access function access]]
+[def __overload_specialized_algorithms__ [link boost_overload.references.boost_overload_hpp.class_template_overload.description.overload_specialized_algorithms specialized algorithms]]
+[def __boost_overload_make_overload_hpp__ [link boost_overload.references.boost_overload_make_overload_hpp `<boost/overload/make_overload.hpp>`]]
+[def __make_overload__ [link boost_overload.references.boost_overload_make_overload_hpp.generative_function_make_overload `make_overload`]]
+
+[def __this_type__ [link ref_overload_this_type this_type]]
+[def __wrapped_function__ [link ref_overload_wrapped_function wrapped_function]]
+[def __overload_tt_signature__ [link ref_overload_tt_signature signature]]
+[def __overload_tt_function__ [link ref_overload_tt_function function]]
+[def __overload_tt_index_of_sig__ [link ref_overload_tt_index_of_sig index_of_signature]]
+[def __overload_tt_has_signature__ [link ref_overload_tt_has_signature has_signature]]
+[def __overload_tt_shares_any_sig_with__ [link ref_overload_tt_shares_any_sig_with shares_any_signature_with]]
+
+[def __overload_extent__ [link ref_overload_extent extent]]
+[def __default_ctor__ [link ref_overload_default_ctor __overload__]]
+[def __copy_ctor__ [link ref_overload_copy_ctor __overload__]]
+[def __ctor_F1__ [link ref_overload_ctor_F1 __overload__]]
+[def __ctor_F1_F2__ [link ref_overload_ctor_F1___FN __overload__]]
+[def __ctor_F1___FN__ [link ref_overload_ctor_F1___FN __overload__]]
+[def __op_assign__ [link ref_overload_op_assign `operator()`]]
+[def __overload_dtor__ [link ref_overload_dtor ~__overload__]]
+[def __set__ [link ref_overload_set_F1 `set`]]
+[def __set_F1__ [link ref_overload_set_F1 `set`]]
+[def __set_F1_F2__ [link ref_overload_set_F1___FN `set`]]
+[def __set_F1___FN__ [link ref_overload_set_F1___FN `set`]]
+[def __set_for_each_shared_sig__ [link ref_overload_set_for_each_shared_sig `set_for_each_shared_signature`]]
+[def __set_sig__ [link ref_overload_set_S_F `set<Signature>`]]
+[def __set_idx__ [link ref_overload_set_N_F `set<N>`]]
+[def __set_S_F__ [link ref_overload_set_S_F `set`]]
+[def __set_N_F__ [link ref_overload_set_N_F `set`]]
+[def __swap_function__ [link ref_overload_swap_function `swap_function`]]
+[def __swap__ [link ref_overload_swap `swap`]]
+[def __clear_all__ [link ref_overload_clear_all `clear_all`]]
+[def __clear_sig__ [link ref_overload_clear_S `clear<Signature>`]]
+[def __clear_S__ [link ref_overload_clear_S `clear`]]
+[def __clear_N__ [link ref_overload_clear_N `clear`]]
+[def __empty_all__ [link ref_overload_empty_all `empty_all`]]
+[def __empty_any__ [link ref_overload_empty_any `empty_any`]]
+[def __empty_none__ [link ref_overload_empty_none `empty_none`]]
+[def __empty_sig__ [link ref_overload_empty_S `empty<Signature>`]]
+[def __empty_S__ [link ref_overload_empty_S `empty`]]
+[def __empty_N__ [link ref_overload_empty_N `empty`]]
+[def __get_sig__ [link ref_overload_get_S `get<Signature>`]]
+[def __get_S__ [link ref_overload_get_S `get`]]
+[def __get_N__ [link ref_overload_get_N `get`]]
+[def __get_S_const__ [link ref_overload_get_S_const `get`]]
+[def __get_N_const__ [link ref_overload_get_N_const `get`]]
+[def __gloabal_overload_swap__ [link ref_global_overload_swap `swap`]]
+
+
+[def __tt_extent__ [link ref_tt_extent extent]]
+[def __tt_signature__ [link ref_tt_signature signature]]
+[def __tt_function__ [link ref_tt_function function]]
+[def __tt_index_of_sig__ [link ref_tt_index_of_sig index_of_signature]]
+[def __tt_has_signature__ [link ref_tt_has_signature has_signature]]
+[def __tt_have_any_shared_sig__ [link ref_tt_have_any_shared_sig have_any_shared_signature]]
+
+[def __call_sig__ [link boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects call signature]]
+[def __callable_object__ [link boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects callable object]]
+[def __callable_type__ [link boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects callable object type]]
+[def __functor__ [link boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects functor]]
+[def __explicit_signature__ [link boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects explicit call signature]]
+[def __implicit_signature__ [link boost_overload.design_and_definitions.definitions.call_signatures_and_callable_objects implicit call signature]]
+[def __function_object__ [link boost_overload.design_and_definitions.definitions.function_objects function object]]
+
+[template plural[word] [word]s]
+
+[import ../../examples/overview.cpp]
+[import ../../examples/basic_usage.cpp]
+[import ../../examples/compatible_signature.cpp]
+[import ../../examples/helper_methods.cpp]
+[import ../../examples/index_syntax.cpp]
+[import ../../examples/lambda_result_type_support.cpp]
+[import ../../examples/make_overload.cpp]
+[import ../../examples/result_of_support.cpp]
+[import ../../examples/set_for_each_shared_signature.cpp]
+[import ../../examples/signature_syntax_1.cpp]
+[import ../../examples/signature_syntax_2.cpp]
+[import ../../examples/signature_syntax_3.cpp]
+[import ../../examples/statefull_polymorphic_function_object.cpp]
+[import ../../examples/type_traits.cpp]
+[import ../../examples/use_case_variant_visitor.cpp]
+[import ../../examples/using_boost_function.cpp]
+[import ../../examples/using_function_objects.cpp]
+[import ../../examples/using_member_functions.cpp]
+
+
+
+[warning At present Boost.Overload *IS NOT* a Boost Library ]
+
+[include getting_started.qbk]
+[include tutorial.qbk]
+[include use_cases.qbk]
+[include advanced_features.qbk]
+[include design_and_definitions.qbk]
+[include references.qbk]
+
+
+[section Acknowledgements]
+
+Thanks go to Joel De Guzman for posting an implementation of a minimal overload
+implementation to the Boost C++ Developer Mailing List, and to Douglas Gregor
+for Boost.Function -- without which all this would not have been possible.
+I especially thank Dean Michael Berris that contributed to prepare some parts
+of this documentation.
+
+[endsect]
+

Added: sandbox/overload/trunk/libs/overload/docs/qbk/references.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/references.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,581 @@
+
+[/ Copyright (C) 2012 Marco Cecchetti ]
+[/ Use, modification, and distribution is subject to the Boost Software ]
+[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
+[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
+
+[section References]
+
+[section:boost_overload_hpp <boost/overload.hpp>]
+
+[section Class template overload]
+
+[section Synopsis]
+
+ template<typename Signature1,
+ typename Signature2 = detail::no_signature,
+ .
+ .
+ typename SignatureK = detail::no_signature> // K == BOOST_OVERLOAD_LIMITS
+ class overload
+ : public detail::overload_base<0, Signature1, Signature2, ..., SignatureK>
+ {
+ public:
+ // types
+ typedef overload<Signature1, Signature2, ..., SignatureK> this_type; ``[#ref_overload_this_type]``
+ typedef detail::overload_base<0, Signature1, Signature2, ..., SignatureK> base_type;
+
+ // wrapped function type
+ template <typename Signature>
+ struct wrapped_function ``[#ref_overload_wrapped_function]``
+ {
+ typedef __boost_function_class__<Signature> type;
+ };
+
+ // static constants
+ static const unsigned int extent = __tt_extent__<__this_type__>::value; ``[#ref_overload_extent]``
+
+ // ``__overload_type_traits__``
+ template<unsigned int I>
+ struct __overload_tt_signature__;
+
+ template<unsigned int I>
+ struct __overload_tt_function__;
+
+ template<typename Signature>
+ struct __overload_tt_index_of_sig__;
+
+ template<typename Signature>
+ struct __overload_tt_has_signature__;
+
+ template<typename Functor>
+ struct __overload_tt_shares_any_sig_with__;
+
+ // Lambda library support
+ template<typename Args>
+ struct sig;
+
+ // ResultOf library support
+ template<typename CallType>
+ struct result;
+
+ // ``__overload_ctor_copy_dtor__``
+ __default_ctor__();
+ __copy_ctor__(const __this_type__& );
+ template<typename Functor>
+ __ctor_F1__(const Functor& );
+ template<typename F1, typename F2>
+ __ctor_F1_F2__(const F1&, const F2& );
+ .
+ .
+ .
+ template<typename F1, typename F2, ..., typename FN> // ``N == __overload_extent__``
+ __ctor_F1___FN__(const F1&, const F2&, ..., const FN& );
+ __this_type__& __op_assign__(const __this_type__& );
+ __overload_dtor__();
+
+ // ``__overload_modifiers__``
+ template<typename Functor>
+ __this_type__& __set_F1__(const Functor& );
+ template<typename F1, typename F2>
+ __this_type__& __set_F1_F2__(const F1&, const F2& );
+ .
+ .
+ .
+ template<typename F1, typename F2, ..., typename FN> // ``N == __overload_extent__``
+ __this_type__& __set_F1___FN__(const F1&, const F2&, ..., const FN& );
+ template<typename Signature, typename Functor>
+ __this_type__& __set_S_F__(const Functor& );
+ template<unsigned int I, typename Functor>
+ __this_type__& __set_N_F__(const Functor& );
+
+ template<typename Functor>
+ __this_type__& __set_for_each_shared_sig__(const Functor& );
+
+ void __swap__(__this_type__& );
+ template<typename Signature>
+ void __swap_function__(__boost_function_class__<Signature>& );
+
+ void __clear_all__();
+ template<typename Signature>
+ void __clear_S__();
+ template<unsigned int I>
+ void __clear_N__();
+
+ // ``__overload_capacity__``
+ bool __empty_all__();
+ bool __empty_any__();
+ bool __empty_none__();
+ template<typename Signature>
+ bool __empty_S__();
+ template<unsigned int I>
+ bool __empty_N__();
+
+ // ``__overload_function_access__``
+ template<typename Signature>
+ typename __wrapped_function__<Signature>::type& __get_S__();
+ template<unsigned int I>
+ typename __overload_tt_function__<I>::type& __get_N__();
+ template<typename Signature>
+ const typename __wrapped_function__<Signature>::type& __get_S_const__() const;
+ template<unsigned int I>
+ const typename __overload_tt_function__<I>::type& __get_N_const__() const;
+
+ };
+
+ // ``__overload_specialized_algorithms__``
+ template<typename S1, typename S2, typename SK> // K == BOOST_OVERLOAD_LIMITS
+ void __gloabal_overload_swap__(__overload_class__<S1, S2,...,SK>&, __overload_class__<S1, S2,...,SK>& );
+
+[endsect]
+
+[section Description]
+
+Class template __overload_class__ behaves as an overloaded __boost_function_class__.
+Actually it wraps multiple __boost_function_class__ objects of different call
+signatures. In this context N is equal to `__overload_class__::__overload_extent__`
+and refers to the number of supported call signatures.
+
+[section overload type traits]
+
+# [#ref_overload_tt_signature]
+ `template<unsigned int I>`[br]
+ `struct signature;`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N`.[br]
+ [*Returns]:
+ `signature<I>::type` is the `(I+1)`-th call signature listed in the template
+ argument list of __this_type__.[br]
+[br]
+# [#ref_overload_tt_function]
+ `template<unsigned int I>`[br]
+ `struct function;`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N`.[br]
+ [*Returns]:
+ `function<I>::type` is the same as `__boost_function_class__<S>`, where S is the call
+ signature `__overload_tt_signature__<I>::type`.[br]
+[br]
+# [#ref_overload_tt_index_of_sig]
+ `template<typename Signature>`[br]
+ `struct index_of_signature;`[br]
+ [*Returns]:
+ `index_of_signature<Signature>::value` is an integral constant
+ that represents the position, starting from 0, of the call signature
+ `Signature` in the template argument list of __this_type__ if it is present
+ and `-1` otherwise .[br]
+[br]
+# [#ref_overload_tt_has_signature]
+ `template<typename Signature>`[br]
+ `struct has_signature;`[br]
+ [*Returns]:
+ `has_signature<Signature>::value` is a boolean constant equals to `true`
+ if __this_type__ supports the call signature `Signature` and `false` otherwise.[br]
+[br]
+# [#ref_overload_tt_shares_any_sig_with]
+ `template<typename Functor>`[br]
+ `struct shares_any_signature_with;`[br]
+ [*Returns]:
+ `shares_any_signature_with<Functor>::value` is a boolean constant equals to
+ `true` if __this_type__ shares at least one call signature with the
+ __callable_type__ `Functor`.[br]
+[br]
+
+[endsect]
+
+[section:overload_ctor_copy_dtor overload public construct/copy/destruct]
+
+# [#ref_overload_default_ctor]
+ `overload();`[br]
+ [*Post conditions]:
+ `this->__empty_all__()`.[br]
+ [*Throws]:
+ Will not throw.[br]
+[br]
+# [#ref_overload_copy_ctor]
+ `overload(const __this_type__& f);`[br]
+ [*Post conditions]:
+ Each object target is in the same state as the copied object target of `f`.[br]
+ [*Throws]:
+ Will not throw unless copying one of the object targets of `f` throws.[br]
+[br]
+# [#ref_overload_ctor_F1]
+ `template<typename Functor>`[br]
+ `overload(const Functor& f);`[br]
+ [*Requires]:
+ `f` is a monomorphic __callable_object__ that is callable by `*this`.[br]
+ [*Post conditions]:
+ The object target related to `S` is a copy of `f` if `f` is not empty or
+ `this->__empty_S__<S>()` if `f` is empty, where `S` is the call signature
+ supported by `f`.[br]
+[br]
+# [#ref_overload_ctor_F1___FN]
+ `template<typename F1, typename F2, ..., typename FN>`[br]
+ `overload(const F1& f1, const F2& f2, ..., const FN& fN);`[br]
+ [*Requires]:
+ `f1,f2,...,fN` are monomorphic [plural __callable_object__] that are
+ callable by `*this`.[br]
+ [*Post conditions]:
+ For each `I=1,...N` the object target related to `S` is a copy of `fI`
+ if `fI` is not empty or `this->__empty_S__<S>()` if `fI` is empty, where
+ `S` is the call signature supported by `fI`.[br]
+[br]
+# [#ref_overload_op_assign]
+ ` __this_type__& operator=(const __this_type__& f);`[br]
+ [*Post conditions]:
+ If copy construction does not throw, for each supported call signature `S`
+ `*this` targets a copy of `f`'s target related to `S`, if it has one, or is
+ empty if `f.__empty_S__<S>()`. If copy construction does throw while
+ copying the `I`-th object target then `this->__get_N__<J>()` is a copy of
+ `f.__get_N__<J>` for `J<I`, `this->__get_N__<J>()` is not modified for
+ `J>I` and finally `this->__empty_N__<I>()`.[br]
+[br]
+# [#ref_overload_dtor]
+ `~overload();` [br]
+ [*Effetcs]: Destroys each non-empty target.
+[br]
+
+[endsect]
+
+[section overload modifiers]
+
+# [#ref_overload_set_F1]
+ `template<typename Functor>`[br]
+ ` __this_type__& set(const Functor& f);`[br]
+ [*Requires]:
+ `f` is a monomorphic __callable_object__ that is callable by `*this`.[br]
+ [*Post conditions]:
+ The object target related to `S` is a copy of `f` if `f` is not empty or
+ `this->__empty_S__<S>()` if `f` is empty, where `S` is the call signature
+ supported by `f`.[br]
+[br]
+# [#ref_overload_set_F1___FN]
+ `template<typename F1, typename F2, ..., typename FN>`[br]
+ ` __this_type__& set(const F1& f1, const F2& f2, ..., const FN& fN);`[br]
+ [*Requires]:
+ `f1,f2,...,fN` are monomorphic [plural __callable_object__] that are
+ callable by `*this`.[br]
+ [*Post conditions]:
+ For each `I=1,...N` the object target related to `S` is a copy of `fI`
+ if `fI` is not empty or `this->__empty_S__<S>()` if `fI` is empty, where
+ `S` is the call signature supported by `fI`.[br]
+[br]
+# [#ref_overload_set_S_F]
+ `template<typename Signature, typename Functor>`[br]
+ ` __this_type__& set(const Functor& f);`[br]
+ [*Requires]:
+ `Signature` is a call signature supported by `*this` and `f` is a
+ __callable_object__ that is callable by `*this`.[br]
+ [*Post conditions]:
+ The object target related to the call signature `Signature` is a copy of
+ `f` if `f` is not empty or `this->__empty_S__<Signature>()` if `f` is empty.[br]
+[br]
+# [#ref_overload_set_N_F]
+ `template<unsigned int I, typename Functor>`[br]
+ ` __this_type__& set(const Functor& f);`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N` and
+ `f` is a __callable_object__ that is callable by `*this`.[br]
+ [*Post conditions]:
+ The object target related to the call signature
+ `S:=__overload_tt_signature__<I>::type` is a copy of `f` if `f` is not
+ empty or `this->__empty_S__<S>()` if `f` is empty.[br]
+[br]
+# [#ref_overload_set_for_each_shared_sig]
+ `template<typename Functor>`[br]
+ ` __this_type__& set_for_each_shared_signature(const Functor& f);`[br]
+ [*Requires]:
+ `f` is a __callable_object__ that is callable by `*this` with any call
+ signature shared by both `*this` and `f`.[br]
+ [*Post conditions]:
+ For each call signature `S` shared by both `*this` and `f` the object target
+ related to `S` is a copy of `f` if `f` is not empty or `this->__empty_S__<S>()`
+ if `f` is empty.[br]
+[br]
+# [#ref_overload_swap]
+ `void swap(__this_type__& f);`[br]
+ [*Effetcs]:
+ For each supported call signature `S` interchanges the object targets of
+ `*this` and `f` related to `S`[br]
+[br]
+# [#ref_overload_swap_function]
+ `template<typename Signature>`[br]
+ `void swap_function(__boost_function_class__<Signature>& f);`[br]
+ [*Requires]:
+ `Signature` is a call signature supported by `*this`.[br]
+ [*Effetcs]:
+ Interchanges the object target of `*this` related to the call signature
+ `Signature` with the object target of `f`.
+[br]
+# [#ref_overload_clear_all]
+ `void clear_all();`[br]
+ [*Post conditions]: `this->__empty_all__()`.[br]
+[br]
+# [#ref_overload_clear_S]
+ `template<typename Signature>`[br]
+ `void clear();`[br]
+ [*Requires]:
+ `Signature` is a call signature supported by `*this`.[br]
+ [*Post conditions]:
+ `this->__empty_S__<Signature>()`.[br]
+[br]
+# [#ref_overload_clear_N]
+ `template<unsigned int I>`[br]
+ `void clear();`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N`.[br]
+ [*Post conditions]:
+ `this->__empty_N__<I>()`.[br]
+[br]
+
+[endsect]
+
+[section overload capacity]
+
+# [#ref_overload_empty_all]
+ `bool empty_all();`[br]
+ [*Returns]:
+ `false` if `*this` has at least one call signature `S` such that `!this->__empty_S__<S>()`
+ and `true` otherwise.[br]
+[br]
+# [#ref_overload_empty_any]
+ `bool empty_any();`[br]
+ [*Returns]:
+ `false` if for each supported call signature `S` `!this->__empty_S__<S>()`
+ and `true` otherwise.[br]
+[br]
+# [#ref_overload_empty_none]
+ `bool empty_none();`[br]
+ [*Returns]:
+ `false` if `*this` has at least one call signature `S` such that `this->__empty_S__<S>()`
+ and `true` otherwise.[br]
+[br]
+# [#ref_overload_empty_S]
+ `template<typename Signature>`[br]
+ `bool empty();`[br]
+ [*Requires]:
+ `Signature` is a call signature supported by `*this`.[br]
+ [*Returns]:
+ `false` if `this->__get_S__<Signature>()` has a target and `true` otherwise.[br]
+[br]
+# [#ref_overload_empty_N]
+ `template<unsigned int I>`[br]
+ `bool empty();`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N`.[br]
+ [*Returns]:
+ `false` if `this->__get_N__<I>()` has a target and `true` otherwise.[br]
+[br]
+
+[endsect]
+
+[section overload function access]
+
+# [#ref_overload_get_S]
+ `template<typename Signature>`[br]
+ `typename __wrapped_function__<Signature>::type& get();`[br]
+ [*Requires]:
+ `Signature` is a call signature supported by `*this`.[br]
+ [*Returns]:
+ a reference to the unique embedded object of type `__boost_function_class__<Signature>`[br]
+[br]
+# [#ref_overload_get_N]
+ `template<unsigned int I>`[br]
+ `typename __overload_tt_function__<I>::type& get();`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N`.[br]
+ [*Returns]:
+ a reference to the unique embedded object of type `__boost_function_class__<S>`
+ where `S` is the call signature `__overload_tt_signature__<I>::type`[br]
+[br]
+# [#ref_overload_get_S_const]
+ `template<typename Signature>`[br]
+ `const typename __wrapped_function__<Signature>::type& get() const;`[br]
+ [*Requires]:
+ `Signature` is a call signature supported by `*this`.[br]
+ [*Returns]:
+ a const reference to the unique embedded object of type `__boost_function_class__<S>`
+ where `S` is the call signature `__overload_tt_signature__<I>::type`[br]
+[br]
+# [#ref_overload_get_N_const]
+ `template<unsigned int I>`[br]
+ `const typename __overload_tt_function__<I>::type& get() const;`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N`.[br]
+ [*Returns]:
+ a const reference to the unique embedded object of type `__boost_function_class__<Signature>`[br]
+[br]
+
+[endsect]
+
+[section overload specialized algorithms]
+
+# [#ref_global_overload_swap]
+ `template<typename S1, typename S2, typename SK> // K == BOOST_OVERLOAD_LIMITS`[br]
+ `void swap(__overload_class__<S1, S2,...,SK>& f1, __overload_class__<S1, S2,...,SK>& f2);`[br]
+ [*Effects]: `f1.__swap__(f2)`.
+[br]
+
+[endsect]
+
+[endsect]
+
+[endsect]
+
+[section Call Wrapper Type Traits]
+
+[section Synopsis]
+
+ namespace boost{ namespace overloads{
+
+ template<typename CallWrapperType>
+ struct __tt_extent__;
+
+ template<typename CallWrapperType, unsigned int I>
+ struct __tt_signature__;
+
+ template<typename CallWrapperType, unsigned int I>
+ struct __tt_function__;
+
+ template<typename CallWrapperType, typename Signature>
+ struct __tt_index_of_sig__;
+
+ template<typename CallWrapperType, typename Signature>
+ struct __tt_has_signature__;
+
+ template<typename CallWrapperType, typename Functor>
+ struct __tt_have_any_shared_sig__;
+
+ } } // end namespaces
+
+[endsect]
+
+[section Description]
+
+# [#ref_tt_extent]
+ `template<typename CallWrapperType>`[br]
+ `struct extent;`[br]
+ [*Returns]:
+ `extent<CallWrapperType>::value` is a non-negative integral constant equals
+ to the number of call signatures supported by `CallWrapperType`.[br]
+[br]
+# [#ref_tt_signature]
+ `template<typename CallWrapperType, unsigned int I>`[br]
+ `struct signature;`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N` where `N = __tt_extent__<CallWrapperType>::value`.[br]
+ [*Returns]:
+ `signature<CallWrapperType, I>::type` is the `(I+1)`-th call signature listed
+ in the template argument list of `CallWrapperType`.[br]
+[br]
+# [#ref_tt_function]
+ `template<typename CallWrapperType, unsigned int I>`[br]
+ `struct function;`[br]
+ [*Requires]:
+ The index `I` is such that `0<=I<N` where `N = extent<CallWrapperType>::value`.[br]
+ [*Returns]:
+ `function<CallWrapperType, I>::type` is the same as `__boost_function_class__<S>`,
+ where `S` is the call signature `__tt_signature__<CallWrapperType, I>::type`.[br]
+[br]
+# [#ref_tt_index_of_sig]
+ `template<typename CallWrapperType, typename Signature>`[br]
+ `struct index_of_signature;`[br]
+ [*Returns]:
+ `index_of_signature<CallWrapperType, Signature>::value` is an integral constant
+ that represents the position, starting from 0, of the call signature
+ `Signature` in the template argument list of `CallWrapperType` if it is present
+ and `-1` otherwise .[br]
+[br]
+# [#ref_tt_has_signature]
+ `template<typename CallWrapperType, typename Signature>`[br]
+ `struct has_signature;`[br]
+ [*Returns]:
+ `has_signature<CallWrapperType, Signature>::value` is a boolean constant
+ equals to `true` if `CallWrapperType` supports the call signature `Signature`
+ and `false` otherwise.[br]
+[br]
+# [#ref_tt_have_any_shared_sig]
+ `template<typename CallWrapperType, typename Functor>`[br]
+ `struct have_any_shared_signature;`[br]
+ [*Returns]:
+ `have_any_shared_signature<CallWrapperType, Functor>::value` is a boolean
+ constant equals to `true` if `CallWrapperType` shares at least one call
+ signature with the __callable_type__ `Functor`.[br]
+[br]
+
+[endsect]
+
+[endsect]
+
+[endsect]
+
+[section:boost_overload_make_overload_hpp <boost/overload/make_overload.hpp>]
+
+[section Generative function make_overload]
+
+[section Synopsis]
+
+ namespace boost{ namespace overloads{
+
+ template<typename F1,
+ typename F2 = detail::no_function,
+ .
+ .
+ typename FK = detail::no_function> // K == BOOST_OVERLOAD_LIMITS
+ struct make_overload_type;
+
+ template<typename F1>
+ typename make_overload_type<F1>::type
+ make_overload(const F1& );
+
+ template<typename F1 , typename F2>
+ typename make_overload_type<F1, F2>::type
+ make_overload(const F1& , const F2&);
+ .
+ .
+ .
+ template<typename F1, typename F2, ..., typename FK> // K == BOOST_OVERLOAD_LIMITS
+ typename make_overload_type<F1, F2, ..., FK>::type
+ make_overload(const F1& , const F2&, ...,const FK& );
+
+ } } // end namespaces
+
+[endsect]
+
+[section Description]
+
+In the following context `N` is an integral constant between 1 and `K=BOOST_OVERLOAD_LIMITS`.
+
+# [#ref_make_overload_type]
+ `template<typename F1 , typename F2, ..., typename FK>`[br]
+ `struct make_overload_type;`[br]
+ [*Requires]:
+ `F1, F2, ..., FK` are [plural __callable_type__] with different call
+ signatures or the `detail::no_function` type.[br]
+ [*Returns]:
+ `make_overload_type<F1, F2, ..., FN>::type` is the same type as
+ `__overload_class__<S1, S2, ..., SN>` where `SI` is the call signature of
+ the __callable_type__ `FI`, for `I=1,..N`.[br]
+[br]
+# [#ref_make_overload]
+ `template<typename F1 , typename F2, ..., typename FN>`[br]
+ `typename make_overload_type<F1, F2, ..., FN>::type`[br]
+ `make_overload(const F1& f1, const F2& f2, ...,const FN& fN);`[br]
+ [*Requires]:
+ `f1,f2,...,fN` are monomorphic [plural __callable_object__] each supporting
+ a different call signature.[br]
+ [*Returns]:
+ An __overload_class__ object `f` that supports all and only the call
+ signatures supported by f1, ..., fN and that for each `I=1,...,N`
+ the object target related to the call signature `__overload_tt_signature__<I>::type`
+ is a copy of `fI`.[br]
+[br]
+
+[endsect]
+
+[endsect]
+
+[endsect]
+
+[endsect]
+

Added: sandbox/overload/trunk/libs/overload/docs/qbk/tutorial.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/tutorial.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,233 @@
+
+[/ Copyright (C) 2012 Marco Cecchetti ]
+[/ Use, modification, and distribution is subject to the Boost Software ]
+[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
+[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
+
+[section Tutorial]
+
+[section Basic usage]
+
+In order to instantiate a template class __overload_class__ you have to specify the
+required [? __call_sig__ __call_sig__]s as template arguments and then you can
+set the [? __callable_object__ __callable_object__]s as targets through the
+__set__ method which support automatic __call_sig__ deduction of the passed
+argument for monomorphic functors.
+
+[basic_usage_cpp]
+
+[note If you try to instantiate a template class __overload_class__ using the same
+__call_sig__ as template argument more than once you get a compile time error.]
+
+Even if the callable targets are set at run-time, the function call relies on
+standard C++ overload resolution: [_the right callable target is selected at
+compile time], so the run-time overhead for the call is the same that you have
+using __Boost_Function__.
+
+[endsect]
+
+[section Backward compatibility: boost::overload is a boost::function]
+
+For any __call_sig__ /S/ used as a template argument of an instantiation /O/
+of the class template __overload_class__, the type `boost::function<S>` is a base
+class type for the instantiation /O/.
+That means you can pass a (const) reference/pointer to an object of type
+`overload<..,S,...>` everywhere a (const) reference/pointer to an object of
+type `boost::function<S>` is expected.
+
+[endsect]
+
+
+[section Supported types of callable entities]
+
+You can utilize different kinds of callable entities: free functions,
+[? __function_object__ __function_object__]s, function objects wrapped with
+`boost::ref` and `boost::function`s.
+Moreover you have support for member functions too. Given a member function
+/mf/ of a class `T`, all you have to do is to specify a const or non-const
+__explicit_signature__ of `T::`['`mf`] as a template argument of __overload_class__
+and pass a pointer to the member function to the __set__ method. You'll get an
+overloaded function call operator that is able to perform a forwarding call to
+`T::`['`mf`] using any object of type `T`.
+
+[warning The constructor and the __set__ method can manage only monomorphic
+callable objects, if you try to pass to them a polymorphic functor (i.e. a
+callable object that is overloaded or that involve a template parameter) you'll
+get a compile time error. The only exception is for a polymorphic function
+object of class type that shares with the overload object one and only one call
+signature.]
+
+[section Example - Using Function Objects]
+[using_function_objects_cpp]
+[endsect]
+
+[section Example - Using Boost.Function]
+[using_boost_function_cpp]
+[endsect]
+
+[section Example - Using member functions]
+[using_member_functions_cpp]
+[endsect]
+
+In the above examples we have always set a single callable object at time,
+however the __set__ method is able to set up multiple callable objects at once.
+For instance referring to the last example you can write:
+
+``
+f.set(&foo, &Alpha::code);
+``
+
+The order you pass the callable objects does not matter. You could have written
+the previous line of code as `f.set(&Alpha::code, &foo)`.
+Moreover you can pass the callable objects directly in the constructor:
+
+``
+overload<signature1_t, signature2_t> f(&foo, &Alpha::code);
+``
+
+As for the __set__ method the order of the arguments does not matter and you
+can pass only monomorphic callable objects. Moreover both the constructor and
+the __set__ method accept only callable objects whose call signature is equal
+to one of the call signatures supported by the overload object. For instance
+the following lines of code do not compile:
+
+``
+int foo(std::string ){ return 1; }
+int bar(double ) { return 2; }
+
+int main()
+{
+ overload<int (std::string ), int (int )> f;
+
+ f.set(&foo); // ok foo call signature matches
+ // the first call signature of f
+
+ f.set(&bar); // compile error: bar call signature does not
+ // match any call signature supported by f
+}
+``
+
+[warning If you try to pass to the constructor or to the __set__ method a
+callable object with a call signature that does not match one of the call
+signatures supported by the given instantiation of the template class
+__overload_class__ you get a compile time error.]
+
+[warning The __set__ method does not work properly with __Boost_Bind__ and
+__Boost_Lambda__]
+
+In order to workaround the limitations of the __set__ method you should utilize
+the __set_sig__ or the __set_idx__ methods.
+
+[endsect]
+
+[section The call signature based syntax]
+
+If you need to set a polymorphic callable object as object target of a given
+overload object for a specific supported call signature you can always use the
+__set_sig__ method. Look at the following examples:
+
+[section Example - A multi-signature function object]
+[signature_syntax_1_cpp]
+[endsect]
+
+[note Any method that accepts a polymorphic function object as argument accepts
+also an instance of the class template __overload_class__.]
+
+All that work for free and member polymorphic functions too:
+
+[section Example - Free and member polymorphic functions]
+[signature_syntax_2_cpp]
+[endsect]
+
+[note Obviously, in case you wish, you can use the __set_sig__ method with
+monomorphic callable objects too.]
+
+[warning Given a template free function `foo` and a call signature /S/,
+supported by `foo`, the expression `f.set<S>(&foo)`, where `f` is an overload
+object that supports the call signature /S/, compiles without any error only if
+all template parameters involved in the declaration of `foo` are deducible by
+the call signature /S/. The same applies to template member functions and
+template function objects.]
+
+The call signature synatx let us set up as object target a functor whose call
+signature is compatible with, but does not match a given call signature of an
+overload object. This situation is showed in the following example:
+
+[section Example - A functor with a call signature that is only compatible]
+[compatible_signature_cpp]
+[endsect]
+
+[endsect]
+
+[section The index based syntax]
+
+Besides the __set_sig__ method you can utilize also the __set_idx__ method
+where `N` must be an integer included in the range from 0 to the number of call
+signatures supported by the given overload object less one.
+Given an overload object `f` and a functor `g`, the call `f.set<N>(g)` is
+equivalent to the call `f.set<S>(g)` where `S` is the N-1 call signature listed
+in the template argument list for the instantiation of the type of the overload
+object `f`. As an example we reimplement the example that shows how to set up a
+polymorphic function object by using the index based syntax.
+
+[/ section Example - Using the index based syntax with a multi-signature function
+object]
+[index_syntax_cpp]
+[/ endsect]
+
+[endsect]
+
+[section The make_overload utility]
+
+__Boost_Overload__ provides an utility named __make_overload__ to create an
+__overload_class__ object on the fly without the need to specify the __call_sig__ of
+each callable object passed as argument. A limitation of the __make_overload__
+utility is that it can handle only monomorphic callable objects.
+
+[note In order to utilize the __make_overload__ utility you need to include
+the header file __boost_overload_make_overload_hpp__ ]
+
+[warning __make_overload__ utility implementation depends on __Boost_TypeOf__ ]
+
+[/ section Example]
+[make_overload_cpp]
+[/ endsect]
+
+[endsect]
+
+[section Helper methods]
+
+There are some helper methods provided by the template class overload and that
+mimic the ones offered by the `boost::function` template class:
+
+* we have the __empty_sig__ method that tell us if it is set an object target
+ related to the specified call signature;
+* the __empty_all__ method that tell us if all object targets are empty;
+* the __empty_any__ method that tell us if any object targets are empty
+* the __empty_none__ method that returns true if no object target is empty;
+* the __get_sig__ method return a (const) reference to the embedded object of
+ type `boost::function<Signature>`;
+* the __clear_sig__ method clears the objecttarget related to the specified
+ signature;
+* the __clear_all__ method that clears all the object targets.
+* the __swap__ method that accepts overload objects of the same type of
+ `(*this)` its action is to exchange the object targets for each pair of
+ embedded `boost::function` objects with the same call signature;
+* finally we have the __swap_function__ method that takes only callable entities of
+ type `boost::function<Signature>` where `Signature` has to be a supported
+ signature of the given instantiation of the template class __overload_class__; its
+ action is to swap the object target of the passed `boost::function<Signature>`
+ instance with the object target of the embedded `boost::function<Signature>`
+ object.
+
+[/ section Example - Helper methods]
+[helper_methods_cpp]
+[/ endsect]
+
+[note For any helper method that supports the call signature syntax there is an
+equivalent method that supports the index syntax.]
+
+[endsect]
+
+[endsect]
+

Added: sandbox/overload/trunk/libs/overload/docs/qbk/use_cases.qbk
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/docs/qbk/use_cases.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,18 @@
+[/ Copyright (C) 2012 Marco Cecchetti ]
+[/ Use, modification, and distribution is subject to the Boost Software ]
+[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
+[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
+
+[section Use case]
+
+[section A Boost.Variant visitor]
+
+In the following example you will see __Boost_Overload__ used to design an
+overloaded visitor utility template class that let us create a dynamic visitor
+for a variant object.
+
+[use_case_variant_visitor_cpp]
+
+[endsect]
+
+[endsect]

Deleted: sandbox/overload/trunk/libs/overload/docs/tutorial.qbk
==============================================================================
--- sandbox/overload/trunk/libs/overload/docs/tutorial.qbk 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,529 +0,0 @@
-
-[section:tutorial Tutorial]
-
-[section:basic_usage Basic usage]
-
-In order to instantiate a template class __overload__ you have to specify the
-required signatures as template arguments and then you can set the callable
-targets through the __set__ method which support automatic signature deduction
-of the passed argument.
-
-[:*Example 1 - Basic usage*]
- int int_sum(int x, int y)
- {
- return x + y;
- }
-
- float float_inc(float x )
- {
- return x + 1.0f;
- }
-
- int main()
- {
- overload<int (int, int ), float (float )> f;
-
- f.set(&int_sum); // here automatic signature
- f.set(&float_inc); // deduction occurs
-
- int r1 = f(1, 2); // calls int_sum
- float r2 = f(3.0f); // calls float_inc
-
- BOOST_ASSERT(r1 == 3);
- BOOST_ASSERT(r2 == 4.0f);
-
- return 0;
- }
-
-[important If you try to instantiate a template class __overload__ using the
-same signature as template argument more than once you get a compile time
-error.]
-
-Even if the callable targets are set at run-time, the function call relies on
-standard C++ overload resolution: [_the right callable target is selected at
-compile time], so the run-time overhead for the call is the same that you have
-using [@http://www.boost.org/doc/html/function/misc.html#id1215718
-Boost.Function].
-
-[endsect]
-
-[section:supported_callable_entity Supported types of callable entities]
-
-You can utilize different kinds of callable entities: free functions, function
-objects, function objects wrapped with boost::ref and boost::functions.
-Moreover you have support for member functions too. Given a member function
-/mf/ of a class T, all you have to do is to specify a const or non-const
-explicit signature of T::/mf/ as a template argument of __overload__ and pass a
-pointer to the member function to the __set__ method. You'll get an overloaded
-function call operator that is able to perform a forwarding call to T::/mf/
-using any object of type T.
-
-[: *Example 2 - Using different types of callable entities*]
-
- /* free function */
- void foo1(std::string s1, std::string s2, std::string s3)
- {
- std::cout << s1 << s2 << s3 << std::endl;
- }
- typedef void signature1_t (std::string , std::string , std::string );
-
- /* member function */
- struct bar2
- {
- int foo2(char )
- {
- return 123;
- }
- };
- typedef int signature2_t (bar2*, char ); // explicit non-const signature
-
- /* free function that will be wrapped by a boost::function */
- char bar3(std::string )
- {
- return 'x';
- }
- typedef char signature3_t (std::string );
-
- /* class type function */
- struct bar4
- {
- double operator() (int, char ) const
- {
- return 123.456;
- }
- };
- typedef double signature4_t (int, char );
-
- /* another class type function */
- struct bar5
- {
- int operator() (char )
- {
- return 123;
- }
- };
- typedef int signature5_t (char );
-
-
- int main()
- {
- overload<signature1_t, signature2_t,
- signature3_t, signature4_t, signature5_t> f;
-
- /* instance that will be used for invoking the member function */
- bar2 b2;
- /* boost::function object that uses bar3 as callable target */
- boost::function<signature3_t> foo3(&bar3);
- /* function object */
- bar4 foo4;
- /* function object that will be wrapped with boost::ref */
- bar5 foo5;
-
-
- f.set(&foo1);
- f.set(&bar2::foo2);
- // sets the callable target of foo3 as
- // callable target of f tied to the signature 3
- f.set(foo3);
- f.set(foo4);
- f.set(boost::ref(foo5));
-
-
- f("Hello", " ", "world !"); // calls foo1 and print "Hello world !"
- int r2 = f(&b2, 'x'); // calls b2.foo2
- char r3 = f("hi"); // calls bar3
- double r4 = f(1, 'x'); // calls foo4
- int r5 = f('x'); // calls foo5
-
- BOOST_ASSERT(r2 == 123);
- BOOST_ASSERT(r3 == 'x' );
- BOOST_ASSERT(r4 > 123.455 && r4 < 123.457);
- BOOST_ASSERT(r5 == 123);
-
- return 0;
- }
-
-For simplifying the setting of callable targets the __set__ method has been
-overloaded in order to support until BOOST_OVERLOAD_LIMIT arguments (defaults
-to 10), the same is true for the constructors provided by the template class
-__overload__. So in the above example we could write:
-
- overload<signature1_t, signature2_t, signature3_t, signature4_t, signature5_t>
- f(&bar2::foo2, &foo1, foo4, boost::ref(foo5), foo3);
-
-or:
-
- f.set(&bar2::foo2, &foo1, foo4, boost::ref(foo5), foo3);
-
-as you can see the order of the passed arguments doesn't matter.
-
-[important If you try to set a callable entity with a signature not supported
-by the given instantiation of the template class __overload__ you get a compile
-time error.]
-
-[endsect]
-
-[section:multi_sig_func_obj Multi-signature function objects]
-
-The __set__ method can manage multi-signature function objects (i.e. function
-objects whose operator() is overloaded or is a template function) and it
-handles them in a special way. The passed function object sets/replaces all the
-existent callable targets tied to the signatures supported by both the given
-instantiation of the template class __overload__ and the passed function object
-itself.
-
-[warning Signature deduction of multi-signature function objects is not
-supported with Microsoft Visual C++ 7.1, you have to use the
-[link boost_overload.tutorial.sig_based_syntax signature based syntax] ]
-
-[: *Example 3 - Overloaded function object*]
- char foo2(std::string )
- {
- return 'x';
- }
-
- struct bar
- {
- double operator() (float x)
- {
- return x + 1;
- }
-
- double operator() (float x, float y)
- {
- return x + y;
- }
- };
-
- int main()
- {
- overload<char (std::string ), double (float ), double (float, float )> f;
-
- bar foo;
-
-
- f.set(foo); // sets foo as callable target for both the signature
- // double (float ) and the signature double (float, float )
-
-
- f.set(&foo2);
-
- char r1 = f("hi");
- double r2 = f(1.0f); // calls the double foo(float ) overload
- double r3 = f(2.0f, 3.0f); // calls the double foo(float, float ) overload
-
- BOOST_ASSERT(r1 == 'x');
- BOOST_ASSERT(r2 == 2.0);
- BOOST_ASSERT(r3 == 5.0);
-
- return 0;
- }
-
-[: *Example 4 - Template function object*]
- char foo2(std::string )
- {
- return 'x';
- }
-
- struct bar
- {
- template<typename T>
- T operator()(T x)
- {
- return x + 1;
- }
- };
-
- int main()
- {
- overload<char (std::string ), int (int ), double (double )> f;
-
- bar foo;
-
- f.set(foo); // sets foo as callable target for both the signature
- // int (int ) and the signature double (double )
-
-
- f.set(&foo2);
-
- char r1 = f("hi");
- int r2 = f(1); // calls int foo(int ) template instantiation
- double r3 = f(2.0); // calls double foo(double ) template instantiation
-
- BOOST_ASSERT(r1 == 'x');
- BOOST_ASSERT(r2 == 2);
- BOOST_ASSERT(r3 == 3.0);
-
- return 0;
- }
-
-[tip In order to decrease the risk of run time side effects due to unexpected
-assignments it's a good practice to set multi-signature function objects first.]
-
-[endsect]
-
-[section:sig_based_syntax The signature based syntax]
-
-If you need to set a multi-signature function object as the callable target for
-only one specific supported signature you can always use the __set_sig__ method.
-Look at the following example:
-
-[: *Example 5 - Using the signature based syntax with multi-signature function objects*]
-
- struct bar
- {
- template<typename T>
- T operator()(T x)
- {
- return x;
- }
- };
-
- int main()
- {
- overload<int (int ), std::string (std::string )> f;
-
- bar foo;
-
- f.set<int (int )>(foo); // we are using the signature syntax that sets foo
- // as callable target for the signature int (int ) only
-
- int r1 = f(1); // calls int foo(int ) template instantiation
-
- /* Warning !!
- This call produces a comiler error because there is no callable target
- tied to the "std::string (std::string )" signature
- std:string r2 = f( std::string("hi") );
- */
-
- BOOST_ASSERT(r1 == 1);
-
- return 0;
- }
-
-[important When you work with an instantiation of the template class
-__overload__ that supports both the non-const and the const explicit signature
-of a function member which is const qualified the __set__ method version that
-relies on signature deduction will set the given member function as callable
-target for both the signatures, however you'll get an ambiguous call error if
-you try to pass a non-const pointer to an object of the related class type. In
-this case the signature based syntax should be used to tie the member function
-to only one of the two supported explicit signatures.]
-
-[endsect]
-
-[section:helper_methods Helper Methods]
-
-There are some helper methods provided by the template class __overload__ and
-that mimic the ones offered by the boost::function template class:
-
-* we have the __empty_sig__ method that tell us if it's set a callable target
-related to the specified signature;
-__empty_line__
-
-* the __empty_all__ method that tell us if all callable targets are empty;
-__empty_line__
-
-* the __get_sig__ method return a (const) reference to the embedded object of
-type boost::function<signature_type>;
-__empty_line__
-
-* the __clear_sig__ method clears the callable target related to the specified
-signature;
-__empty_line__
-
-* the __clear_all__ method that clears all the callable targets;
-__empty_line__
-
-* finally we have the __swap_func__ method that takes only callable entities of
-type boost::function<signature_type> where signature_type has to be a
-supported signature by the given instantiation of the template class
-__overload__; its action is to swap the callable target of the passed
-boost::function<signature_type> instance with the callable target of the
-embedded boost::function<signature_type> object.
-
-[: *Example 6 - Using helper methods*]
-
- void foo1(std::string s1, std::string s2, std::string s3)
- {
- std::cout << s1 << s2 << s3 << std::endl;
- }
- typedef void signature1_t (std::string , std::string , std::string );
-
-
- int foo2(int x)
- {
- return x + 1;
- }
- typedef int signature2_t (int );
-
-
- int main()
- {
- overload<signature1_t, signature2_t> f(&foo1, &foo2);
-
- f("Hello", " ", "world !"); // print "Hello world !"
-
- f.clear<signature1_t>();
- BOOST_ASSERT( f.empty<signature1_t>() ); // f has no callable target
- // associated with signature 1
-
- boost::function<signature1_t> g(&foo1); // g has foo1 as callable target
- f.swap_function(g); // after swapping f has foo1
- // as callable target
- f("I'm ", "back ", "again !"); // associated with signature 1
- BOOST_ASSERT( g.empty() ); // and g has no callable target
-
- g = f.get<signature1_t>(); // g is set to the embedded object
- g("That's ", "all ", "folks !"); // of f with type
- // boost::function<signature1_t>
-
- f.clear_all(); // now f has no callable target
- BOOST_ASSERT( f.empty_all() ); // associated to any signature
-
- return 0;
- }
-
-[endsect]
-
-[section:overloaded_func Non-member and member overloaded functions]
-
-In order to set a free function overload as callable target there are two
-options :
-
-[: *Example 7a - Setting a free function overload as callable target*]
-
- int foo(int )
- {
- return 1;
- }
-
- int foo(std::string )
- {
- return 2;
- }
-
- int main()
- {
- overload<int (int ), int (std::string )> f;
-
- int (*foo1) (int ) = &foo;
- int (*foo2) (std::string ) = &foo;
-
- f.set(foo1);
- f.set(foo2);
-
- BOOST_ASSERT( f(0) == 1 );
- BOOST_ASSERT( f("hi") == 2 );
-
- return 0;
- }
-
-The above example shows the classic solution. The second example shows how it's
-possible to achieve the same result using the signature based syntax.
-
-[: *Example 7b - Setting a free function overload as callable target*]
-
- int foo(int )
- {
- return 1;
- }
-
- int foo(std::string )
- {
- return 2;
- }
-
- int main()
- {
- overload<int (int ), int (std::string )> f;
-
- // disambiguation through the signature based syntax
- f.set<int (int )>(&foo);
- f.set<int (std::string )>(&foo);
-
- BOOST_ASSERT( f(0) == 1 );
- BOOST_ASSERT( f("hi") == 2 );
-
- return 0;
- }
-
-For member function overloads you have the same options :
-
-[: *Example 8a - Setting a member function overload as callable target*]
-
- struct bar
- {
- int foo(int )
- {
- return 1;
- }
-
- int foo(std::string )
- {
- return 2;
- }
- };
-
- int main()
- {
- overload<int (bar*, int ), int (bar*, std::string )> f;
-
- bar b;
-
- int (bar::*foo1) (int ) = &bar::foo;
- int (bar::*foo2) (std::string ) = &bar::foo;
-
- f.set(foo1);
- f.set(foo2);
-
- BOOST_ASSERT( f(&b, 0) == 1 );
- BOOST_ASSERT( f(&b, "hi") == 2 );
-
- return 0;
- }
-
-the above example shows the classic solution. The second example shows how it's
-possible to achieve the same result using the signature based syntax.
-
-[: *Example 8b - Setting a member function overload as callable target*]
-
- struct bar
- {
- int foo(int )
- {
- return 1;
- }
-
- int foo(std::string )
- {
- return 2;
- }
- };
-
- int main()
- {
- overload<int (bar*, int ), int (bar*, std::string )> f;
-
- bar b;
-
- // disambiguation through the signature based syntax
- // note that you have to use the explicit signature
- // of the related member function
- f.set<int (bar*, int )>(&bar::foo);
- f.set<int (bar*, std::string )>(&bar::foo);
-
- BOOST_ASSERT( f(&b, 0) == 1 );
- BOOST_ASSERT( f(&b, "hi") == 2 );
-
- return 0;
- }
-
-[important If the explicit signature supported by the instantiation of the
-template class __overload__ is the non-const qualified version, the signature
-based syntax is not able to manage the case of two member function overloads
-with the same signature that differ for the const qualifier only.]
-
-[endsect]
-
-[endsect]

Added: sandbox/overload/trunk/libs/overload/examples/Jamfile.jam
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/Jamfile.jam 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,29 @@
+# Copyright 2007-2012 (c) Dean Michael Berris, Marco Cecchetti
+# Released under the Boost Software License Version 1.0
+# See http://boost.org/LICENSE_1_0.txt for full license text.
+
+using testing ;
+
+
+test-suite "examples" :
+ [ run overview.cpp ]
+ [ run basic_usage.cpp ]
+ [ run using_function_objects.cpp ]
+ [ run using_boost_function.cpp ]
+ [ run using_member_functions.cpp ]
+ [ run signature_syntax_1.cpp ]
+ [ run signature_syntax_2.cpp ]
+ [ run signature_syntax_3.cpp ]
+ [ run compatible_signature.cpp ]
+ [ run index_syntax.cpp ]
+ [ run helper_methods.cpp ]
+ [ run set_for_each_shared_signature.cpp ]
+ [ run statefull_polymorphic_function_object.cpp ]
+ [ compile result_of_support.cpp ]
+ [ run lambda_result_type_support.cpp ]
+ [ compile type_traits.cpp ]
+ [ run make_overload.cpp ]
+ [ run use_case_variant_visitor.cpp ]
+ ;
+
+

Added: sandbox/overload/trunk/libs/overload/examples/basic_usage.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/basic_usage.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,37 @@
+/*==============================================================
+ Boost Overload
+ Example 1 - Basic usage
+==============================================================*/
+
+//[ basic_usage_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+int int_sum(int x, int y)
+{
+ return x + y;
+}
+
+float float_inc(float x )
+{
+ return x + 1.0f;
+}
+
+
+int main()
+{
+ boost::overload<int (int, int ), float (float )> f;
+
+ f.set(&int_sum); // here automatic signature
+ f.set(&float_inc); // deduction occurs
+
+ int r1 = f(1, 2); // invokes int_sum
+ float r2 = f(3.0f); // invokes float_inc
+
+ BOOST_ASSERT( r1 == 3 );
+ BOOST_ASSERT( r2 == 4.0f );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/compatible_signature.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/compatible_signature.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,50 @@
+/*=============================================================
+ Boost Overload
+ Example 8 - Using the call signature based syntax
+ for setting as target a functor whose call
+ signature is only compatible
+==============================================================*/
+
+//[ compatible_signature_cpp
+#include <string>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+int foo(double ) { return 1; }
+
+
+int main()
+{
+ boost::overload<int (std::string ), int (int )> f1;
+
+ // the call signature of the foo free function does not
+ // match exactly any call signature of f1, anyway it is
+ // compatible with the call signature int (int )
+ // because an int type convert implicitly to a double
+ // for this reason the set<Signature> method let you
+ // pass as argument a functor whose call signature is only
+ // compatible with the call signature Signature
+ f1.set<int (int )>( &foo );
+ // ok the target object tied to the int (int )
+ // call signature is set
+ BOOST_ASSERT( !f1.empty<int (int )>() );
+ // foo is invoked
+ BOOST_ASSERT( f1(1) == foo(1) );
+
+ // all that work even if the overload object owns a call
+ // signature that matches exactly the call signature of the
+ // functor
+ boost::overload<int (double ), int (int )> f2;
+
+ // all work exactly as before
+ f2.set<int (int )>( &foo );
+ BOOST_ASSERT( !f2.empty<int (int )>() );
+ BOOST_ASSERT( f2(1) == foo(1) );
+ // no object target has been set up for
+ // the int (double ) call signature
+ BOOST_ASSERT( f2.empty<int (double )>() );
+
+
+ return boost::report_errors();
+}
+//]

Deleted: sandbox/overload/trunk/libs/overload/examples/example_1.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_1.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,40 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 1 - Basic usage
-==============================================================================*/
-
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-int int_sum(int x, int y)
-{
- return x + y;
-}
-
-float float_inc(float x )
-{
- return x + 1.0f;
-}
-
-int main()
-{
- overload<int (int, int ), float (float )> f;
-
- f.set(&int_sum); // here automatic signature
- f.set(&float_inc); // deduction occurs
-
- int r1 = f(1, 2); // calls int_sum
- float r2 = f(3.0f); // calls float_inc
-
- BOOST_ASSERT(r1 == 3);
- BOOST_ASSERT(r2 == 4.0f);
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_2.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_2.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,99 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 2 - Using different types of callable entities
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-/* free function */
-void foo1(std::string s1, std::string s2, std::string s3)
-{
- std::cout << s1 << s2 << s3 << std::endl;
-}
-typedef void signature1_t (std::string , std::string , std::string );
-
-/* member function */
-struct bar2
-{
- int foo2(char )
- {
- return 123;
- }
-};
-typedef int signature2_t (bar2*, char ); // explicit non-const signature
-
-/* free function that will be wrapped by a boost::function */
-char bar3(std::string )
-{
- return 'x';
-}
-typedef char signature3_t (std::string );
-
-/* class type function */
-struct bar4
-{
- double operator() (int, char ) const
- {
- return 123.456;
- }
-};
-typedef double signature4_t (int, char );
-
-/* another class type function */
-struct bar5
-{
- int operator() (char )
- {
- return 123;
- }
-};
-typedef int signature5_t (char );
-
-
-int main()
-{
- overload<signature1_t, signature2_t,
- signature3_t, signature4_t, signature5_t> f;
-
- /* instance that will be used for invoking the member function */
- bar2 b2;
- /* boost::function object that uses bar3 as callable target */
- boost::function<signature3_t> foo3(&bar3);
- /* function object */
- bar4 foo4;
- /* function object that will be wrapped with boost::ref */
- bar5 foo5;
-
-
- f.set(&foo1);
- f.set(&bar2::foo2);
- // sets the callable target of foo3 as callable target of f
- // tied to the signature 3
- f.set(foo3);
- f.set(foo4);
- f.set(boost::ref(foo5));
-
-
- f("Hello", " ", "world !"); // calls foo1 and print "Hello world !"
- int r2 = f(&b2, 'x'); // calls b2.foo2
- char r3 = f("hi"); // calls bar3
- double r4 = f(1, 'x'); // calls foo4
- int r5 = f('x'); // calls foo5
-
- BOOST_ASSERT(r2 == 123);
- BOOST_ASSERT(r3 == 'x' );
- BOOST_ASSERT(r4 > 123.455 && r4 < 123.457);
- BOOST_ASSERT(r5 == 123);
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_3.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_3.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,58 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 3 - Overloaded function object
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-char foo2(std::string )
-{
- return 'x';
-}
-
-struct bar
-{
- double operator() (float x)
- {
- return x + 1;
- }
-
- double operator() (float x, float y)
- {
- return x + y;
- }
-};
-
-int main()
-{
- overload<char (std::string ), double (float ), double (float, float )> f;
-
- bar foo;
-
-
- f.set(foo); // sets foo as callable target for both the signature double (float )
- // and the signature double (float, float )
-
-
- f.set(&foo2);
-
- char r1 = f("hi");
- double r2 = f(1.0f); // calls the double foo(float ) overload
- double r3 = f(2.0f, 3.0f); // calls the double foo(float, float ) overload
-
- BOOST_ASSERT(r1 == 'x');
- BOOST_ASSERT(r2 == 2.0);
- BOOST_ASSERT(r3 == 5.0);
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_4.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_4.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,52 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 4 - Template function object
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-char foo2(std::string )
-{
- return 'x';
-}
-
-struct bar
-{
- template<typename T>
- T operator()(T x)
- {
- return x + 1;
- }
-};
-
-int main()
-{
- overload<char (std::string ), int (int ), double (double )> f;
-
- bar foo;
-
- f.set(foo); // sets foo as callable target for both the signature int (int )
- // and the signature double (double )
-
- f.set(&foo2);
-
- char r1 = f("hi");
- int r2 = f(1); // calls int foo(int ) template instantiation
- double r3 = f(2.0); // calls double foo(double ) template instantiation
-
- BOOST_ASSERT(r1 == 'x');
- BOOST_ASSERT(r2 == 2);
- BOOST_ASSERT(r3 == 3.0);
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_5.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_5.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,48 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 5 - Using the signature based syntax
- with multi-signature function objects
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-struct bar
-{
- template<typename T>
- T operator()(T x)
- {
- return x;
- }
-};
-
-int main()
-{
- overload<int (int ), std::string (std::string )> f;
-
- bar foo;
-
- f.set<int (int )>(foo); // we are using the signature syntax that sets foo
- // as callable target for the signature int (int ) only
-
- int r1 = f(1); // calls int foo(int ) template instantiation
-
- /* Warning !!
- This call produces a comiler error because there is no callable target
- tied to the "std::string (std::string )" signature
- std:string r2 = f( std::string("hi") );
- */
-
- BOOST_ASSERT(r1 == 1);
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_6.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_6.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,56 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 6 - Using helper methods
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-void foo1(std::string s1, std::string s2, std::string s3)
-{
- std::cout << s1 << s2 << s3 << std::endl;
-}
-typedef void signature1_t (std::string , std::string , std::string );
-
-
-int foo2(int x)
-{
- return x + 1;
-}
-typedef int signature2_t (int );
-
-
-int main()
-{
- overload<signature1_t, signature2_t> f(&foo1, &foo2);
-
- f("Hello", " ", "world !"); // print "Hello world !"
-
- f.clear<signature1_t>();
- BOOST_ASSERT( f.empty<signature1_t>() ); // f has no callable target
- // associated with signature 1
-
- boost::function<signature1_t> g(&foo1); // g has foo1 as callable target
- f.swap_function(g); // after swapping f has foo1
- // as callable target
- f("I'm ", "back ", "again !"); // associated with signature 1
- BOOST_ASSERT( g.empty() ); // and g has no callable target
-
- g = f.get<signature1_t>(); // g is set to the embedded object
- g("That's ", "all ", "folks !"); // of f with type
- // boost::function<signature1_t>
-
- f.clear_all(); // now f has no callable target
- BOOST_ASSERT( f.empty_all() ); // associated to any signature
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_7a.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_7a.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,42 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 7a - Setting a free function overload as callable target
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-int foo(int )
-{
- return 1;
-}
-
-int foo(std::string )
-{
- return 2;
-}
-
-int main()
-{
- overload<int (int ), int (std::string )> f;
-
- int (*foo1) (int ) = &foo;
- int (*foo2) (std::string ) = &foo;
-
- f.set(foo1);
- f.set(foo2);
-
- BOOST_ASSERT( f(0) == 1 );
- BOOST_ASSERT( f("hi") == 2 );
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_7b.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_7b.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,41 +0,0 @@
-/*=============================================================================
- Boost Overload
-
- Example 7b - Setting a free function overload as callable target
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-int foo(int )
-{
- return 1;
-}
-
-int foo(std::string )
-{
- return 2;
-}
-
-int main()
-{
- overload<int (int ), int (std::string )> f;
-
- // disambiguation through the signature based sintax
- f.set<int (int )>(&foo);
- f.set<int (std::string )>(&foo);
-
- BOOST_ASSERT( f(0) == 1 );
- BOOST_ASSERT( f("hi") == 2 );
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_8a.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_8a.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,47 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 8a - Setting a member function overload as callable target
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-struct bar
-{
- int foo(int )
- {
- return 1;
- }
-
- int foo(std::string )
- {
- return 2;
- }
-};
-
-int main()
-{
- overload<int (bar*, int ), int (bar*, std::string )> f;
-
- bar b;
-
- int (bar::*foo1) (int ) = &bar::foo;
- int (bar::*foo2) (std::string ) = &bar::foo;
-
- f.set(foo1);
- f.set(foo2);
-
- BOOST_ASSERT( f(&b, 0) == 1 );
- BOOST_ASSERT( f(&b, "hi") == 2 );
-
- return boost::report_errors();
-}
-

Deleted: sandbox/overload/trunk/libs/overload/examples/example_8b.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/examples/example_8b.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,45 +0,0 @@
-/*=============================================================================
- Boost Overload
- Example 8b - Setting a member function overload as callable target
-==============================================================================*/
-
-
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/overload.hpp>
-
-
-using boost::overload;
-
-
-struct bar
-{
- int foo(int )
- {
- return 1;
- }
-
- int foo(std::string )
- {
- return 2;
- }
-};
-
-int main()
-{
- overload<int (bar*, int ), int (bar*, std::string )> f;
-
- bar b;
-
- // disambiguation through the signature based sintax
- f.set<int (bar*, int )>(&bar::foo);
- f.set<int (bar*, std::string )>(&bar::foo);
-
- BOOST_ASSERT( f(&b, 0) == 1 );
- BOOST_ASSERT( f(&b, "hi") == 2 );
-
- return boost::report_errors();
-}
-

Added: sandbox/overload/trunk/libs/overload/examples/helper_methods.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/helper_methods.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,101 @@
+/*=============================================================
+ Boost Overload
+ Example 6 - Using helper methods
+==============================================================*/
+
+//[ helper_methods_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+int zoo(double ) { return 1; }
+
+template<typename T>
+int foo(T ) { return (2 + sizeof(T)); }
+
+int zoo2(double ) { return -1; }
+
+template<typename T>
+int foo2(T ) { return -(int)(2 + sizeof(T)); }
+
+typedef int sig1 (int );
+typedef int sig2 (double );
+typedef int sig3 (char );
+
+
+int main()
+{
+ // test if a object target is valid
+ boost::overload<sig1, sig2, sig3>f;
+ // all object targets are empty
+ BOOST_ASSERT( f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+ BOOST_ASSERT( f.empty<sig1>() );
+ BOOST_ASSERT( f.empty<sig2>() );
+ BOOST_ASSERT( f.empty<sig3>() );
+
+ f.set<sig1>(&foo);
+ // only the first object target is set
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+ BOOST_ASSERT( !f.empty<sig1>() );
+ BOOST_ASSERT( f.empty<sig2>() );
+ BOOST_ASSERT( f.empty<sig3>() );
+
+ f.set<sig2>(&zoo);
+ // only the last object target is not set
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+ BOOST_ASSERT( !f.empty<sig1>() );
+ BOOST_ASSERT( !f.empty<sig2>() );
+ BOOST_ASSERT( f.empty<sig3>() );
+
+ f.set<sig3>(&foo);
+ // no object target is empty
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_none() );
+ BOOST_ASSERT( !f.empty<sig1>() );
+ BOOST_ASSERT( !f.empty<sig2>() );
+ BOOST_ASSERT( !f.empty<sig3>() );
+
+ f.clear<sig2>();
+ // all object targets set but the second one
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+ BOOST_ASSERT( !f.empty<sig1>() );
+ BOOST_ASSERT( f.empty<sig2>() );
+ BOOST_ASSERT( !f.empty<sig3>() );
+
+ f.clear_all();
+ // all object targets are empty again
+ BOOST_ASSERT( f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+ BOOST_ASSERT( f.empty<sig1>() );
+ BOOST_ASSERT( f.empty<sig2>() );
+ BOOST_ASSERT( f.empty<sig3>() );
+
+
+ // swapping
+ f.set<sig1>(&foo).set<sig2>(&zoo).set<sig3>(&foo);
+ boost::function<sig2> h = f.get<sig2>();
+ BOOST_ASSERT( h(1.0) == zoo(1.0) );
+ h = &zoo2;
+ BOOST_ASSERT( h(1.0) == zoo2(1.0) );
+ f.swap_function(h);
+ BOOST_ASSERT( f(1.0) == zoo2(1.0) );
+ BOOST_ASSERT( h(1.0) == zoo(1.0) );
+ f.set<sig2>(h);
+ BOOST_ASSERT( f(1.0) == zoo(1.0) );
+
+ boost::overload<sig1, sig2, sig3> g;
+ g.set<sig1>(&foo2).set<sig2>(&zoo2).set<sig3>(&foo2);
+ f.swap(g);
+ BOOST_ASSERT( f(1) == foo2(1) );
+ BOOST_ASSERT( f(1.0) == zoo2(1.0) );
+ BOOST_ASSERT( f('x') == foo2('x') );
+ BOOST_ASSERT( g(1) == foo(1) );
+ BOOST_ASSERT( g(1.0) == zoo(1.0) );
+ BOOST_ASSERT( g('x') == foo('x') );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/index_syntax.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/index_syntax.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,56 @@
+/*=============================================================
+ Boost Overload
+ Example 9 - Using the index based syntax
+ with a multi-signature function object
+==============================================================*/
+
+//[ index_syntax_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+/* polymorphic function object */
+struct bar
+{
+ int operator()(int ) { return 1; }
+
+ template<typename T>
+ int operator()(T ) { return ( 2 + sizeof(T) ); }
+};
+
+int main()
+{
+
+ boost::overload<int (int ), int (char ), int (double )> f;
+
+ // function object
+ bar foo;
+
+ // we use the index syntax for setting a copy of
+ // foo as object target for the second call signature
+ // int (char ) only
+ f.set<1>(foo);
+ // invokes int foo(char ) template instantiation
+ BOOST_ASSERT( f('x') == foo('x') );
+ // through the empty<N>() method we check
+ // that no other object target has been set up
+ BOOST_ASSERT( f.empty<0>() );
+ BOOST_ASSERT( f.empty<2>() );
+
+ // now we set a copy of foo as object target tied to
+ // the first call signature int( int )
+ f.set<0>(foo);
+ BOOST_ASSERT( f('x') == foo('x') );
+ BOOST_ASSERT( f(1) == foo(1) );
+ BOOST_ASSERT( f.empty<2>() );
+
+ // and finally we set up also the object target
+ // for the last call signature int(double )
+ f.set<2>(foo);
+ BOOST_ASSERT( f('x') == foo('x') );
+ BOOST_ASSERT( f(1) == foo(1) );
+ BOOST_ASSERT( f(1.0) == foo(1.0) );
+
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/lambda_result_type_support.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/lambda_result_type_support.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,33 @@
+/*=============================================================
+ Boost Overload
+ Example - Boost.Lambda result type support
+==============================================================*/
+
+//[ lambda_result_type_support_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+
+// You need to explicitly enable Boost.Lambda support
+#define BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT
+#include <boost/overload.hpp>
+
+
+int foo(int , std::string ) { return 1; }
+int bar(int, int ) { return 2; }
+
+
+int main()
+{
+ using namespace boost::lambda;
+
+ boost::overload<int (int, std::string ), int (int, int )> f(&foo, &bar);
+
+ std::string hello("hello");
+ BOOST_ASSERT( boost::lambda::bind(f, 10, _1)(hello) == f(10, hello) );
+ BOOST_ASSERT( boost::lambda::bind(f, 10, _1)(5) == f(10, 5) );
+ BOOST_ASSERT( boost::lambda::bind(f, _1, hello)(10) == f(10, hello) );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/make_overload.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/make_overload.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,89 @@
+/*=============================================================
+ Boost Overload
+ Example - make_overload utility
+==============================================================*/
+
+//[ make_overload_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/functional/hash.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/include/for_each.hpp>
+
+// You need this header file for the make_overload utility
+#include <boost/overload/make_overload.hpp>
+
+
+using std::size_t;
+
+
+// A sample struct
+struct Person
+{
+ std::string name;
+ int age;
+ bool student;
+};
+
+// Make the Person struct a Boost.Fusion sequence
+BOOST_FUSION_ADAPT_STRUCT(
+ Person,
+ (std::string, name)
+ (int, age)
+ (bool, student)
+)
+
+// Creates a hash value by combining hash values
+class hash_combine
+{
+ public:
+ hash_combine(size_t& _seed)
+ : m_seed(_seed)
+ {}
+
+ void operator()( size_t hv ) const
+ {
+ m_seed ^= hv + 0x9e3779b9 + (m_seed << 6) + (m_seed >> 2);
+ }
+
+ private:
+ // boost::fusion::for_each needs a const reference function object
+ volatile size_t& m_seed;
+};
+
+// It will be used to generate a hash value for each field of a Person object
+typedef boost::overload<size_t (const std::string & ),
+ size_t (int ),
+ size_t (bool )>
+ person_field_hash_function_type;
+
+// Returns a hash value for an object of Person type
+size_t hash(const Person & person, const person_field_hash_function_type & hf)
+{
+ using namespace boost::fusion;
+
+ size_t seed = 0;
+ hash_combine hc(seed);
+ for_each( transform(person, hf), hc );
+ return seed;
+}
+
+
+int main()
+{
+ Person Anna = {"Anna Rossi", 25, false};
+
+ // We utilize make_overload to create an overload object on the fly
+ std::size_t hv =
+ hash( Anna,
+ boost::make_overload( boost::hash<std::string>(),
+ boost::hash<int>(),
+ boost::hash<bool>() ) );
+
+ std::cout << Anna.name << " hash value: " << hv << std::endl;
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/overview.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/overview.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,22 @@
+/*=============================================================
+ Boost Overload
+ Example - Overview
+==============================================================*/
+
+//[ overview_cpp
+#include <boost/overload.hpp>
+
+int foo(int a) { return a + 1; };
+long bar(int a, int b) { return a + b; };
+
+int main()
+{
+ boost::overload<int (int ), long (int, int )> functions;
+ functions.set(&foo);
+ functions.set(&bar);
+
+ assert(functions(1) == 2);
+ assert(functions(2, 3) == 5L);
+ return 0;
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/result_of_support.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/result_of_support.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,86 @@
+/*=============================================================
+ Boost Overload
+ Example - Boost.ResultOf support
+==============================================================*/
+
+
+#include <boost/detail/lightweight_test.hpp>
+//[ result_of_support_cpp
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/overload.hpp>
+
+using boost::is_same;
+
+struct A {};
+struct B : public A {};
+
+
+typedef boost::overload<int (int ), char (char ), double (double ), A (const A& )>
+ overload_type;
+
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (int ) >::type,
+ int
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (char ) >::type,
+ char
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (double ) >::type,
+ double
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (short int ) >::type,
+ int
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (char& ) >::type,
+ char
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (const float& ) >::type,
+ double
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (B ) >::type,
+ A
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ boost::result_of< overload_type (B& ) >::type,
+ A
+ >::value
+));
+//]
+
+int main()
+{
+ return boost::report_errors();
+}
+
+

Added: sandbox/overload/trunk/libs/overload/examples/set_for_each_shared_signature.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/set_for_each_shared_signature.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,46 @@
+/*=============================================================
+ Boost Overload
+ Example 10 - Using the set_for_each_shared_signature
+ method with a multi-signature function object
+==============================================================*/
+
+//[ set_for_each_shared_signature_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+/* polymorphic function object */
+struct bar
+{
+ int operator()(int ) { return -1; }
+
+ template<typename T>
+ int operator()(T ) { return sizeof(T); }
+};
+
+int main()
+{
+
+ boost::overload<int (int ), int (char ), int (int, int )> f;
+
+ // function object
+ bar foo;
+
+ // we use the set_for_each_shared_signature method
+ // for setting a copy of foo as object target for
+ // both the shared int(int ) and int(char ) call signatures
+ // *warning*: internally two separate boost::functions
+ // are created
+ f.set_for_each_shared_signature(foo);
+ // invokes int foo(int ) template instantiation
+ BOOST_ASSERT( f(1) == foo(1) );
+ // invokes int foo(char ) template instantiation
+ BOOST_ASSERT( f('x') == foo('x') );
+ // through the empty<Signature>() method we check
+ // that object target related to the not shared
+ // int(int, int ) call signature is still empty
+ BOOST_ASSERT( f.empty<int(int, int )>() );
+
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/signature_syntax_1.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/signature_syntax_1.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,56 @@
+/*=============================================================
+ Boost Overload
+ Example 5 - Using the call signature based syntax
+ with a multi-signature function object
+==============================================================*/
+
+//[ signature_syntax_1_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+/* polymorphic function object */
+struct bar
+{
+ int operator()(int ) { return 1; }
+
+ template<typename T>
+ int operator()(T ) { return ( 2 + sizeof(T) ); }
+};
+
+int main()
+{
+
+ boost::overload<int (int ), int (char ), int (double )> f;
+
+ // function object
+ bar foo;
+
+ // we use the call signature syntax for setting a copy of
+ // foo as object target for the call signature int (char )
+ // only
+ f.set<int (char )>(foo);
+ // invokes int foo(char ) template instantiation
+ BOOST_ASSERT( f('x') == foo('x') );
+ // through the empty<Signature>() method we check
+ // that no other object target has been set up
+ BOOST_ASSERT( f.empty<int(int )>() );
+ BOOST_ASSERT( f.empty<int(double )>() );
+
+ // now we set a copy of foo as object target tied to
+ // the call signature int( int )
+ f.set<int (int )>(foo);
+ BOOST_ASSERT( f('x') == foo('x') );
+ BOOST_ASSERT( f(1) == foo(1) );
+ BOOST_ASSERT( f.empty<int(double )>() );
+
+ // and finally we set up also the object target
+ // for the int(double ) call signature
+ f.set<int (double )>(foo);
+ BOOST_ASSERT( f('x') == foo('x') );
+ BOOST_ASSERT( f(1) == foo(1) );
+ BOOST_ASSERT( f(1.0) == foo(1.0) );
+
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/signature_syntax_2.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/signature_syntax_2.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,58 @@
+/*=============================================================
+ Boost Overload
+ Example 6 - Using the call signature based syntax
+ with free and member polymorphic function
+==============================================================*/
+
+//[ signature_syntax_2_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+template<typename T>
+int foo(T ) { return (3 + sizeof(T)); }
+
+struct bar
+{
+ int mf(int ) { return 1; }
+ int mf(double ) { return 2; }
+};
+
+int main()
+{
+
+ boost::overload<int (int ), int (double ),
+ int (bar*, int ), int (bar*, double )> f;
+
+ // bar instance
+ bar abar;
+
+ // set bar::*mf as object target
+ // for the int (bar*, int ) call signature only
+ f.set<int (bar*, int )>(&bar::mf);
+ // invokes int bar.mf(int )
+ BOOST_ASSERT( f(&abar, 1) == abar.mf(1) );
+ BOOST_ASSERT( f.empty<int (bar*, double )>() );
+
+ // set bar::*mf as object target
+ // for the int (bar*, double ) call signature too
+ f.set<int (bar*, double )>(&bar::mf);
+ BOOST_ASSERT( f(&abar, 1.0) == abar.mf(1.0) );
+ BOOST_ASSERT( f(&abar, 1) == abar.mf(1) );
+
+ // set *foo as object target
+ // for the int (int ) call signature only
+ f.set<int (int )>(&foo);
+ BOOST_ASSERT( f(1) == foo(1) );
+ BOOST_ASSERT( f.empty<int (double )>() );
+
+ // set *foo as object target
+ // for the int (double ) call signature too
+ f.set<int (double )>(&foo);
+ BOOST_ASSERT( f(1.0) == foo(1.0) );
+ BOOST_ASSERT( f(1) == foo(1) );
+
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/signature_syntax_3.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/signature_syntax_3.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,96 @@
+/*=============================================================
+ Boost Overload
+ Example 7 - Using the call signature based syntax
+ with two member functions that differ
+ for the const qualifier only
+==============================================================*/
+
+//[ signature_syntax_3_cpp
+#include <string>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+struct bar
+{
+ int mf(int ) { return 1; }
+ int mf(int ) const { return 2; }
+ int mf(double ) { return 3; }
+};
+
+
+int main()
+{
+ // overload object that supports the *non-const* qualified
+ // explicit call signature int (bar*, int )
+ boost::overload<int (bar*, int ), int (bar*, double )> f;
+
+ // bar instance
+ bar foo;
+
+ // we set bar::*mf as object target
+ // for the int (bar*, double ) call signature only
+ f.set<int (bar*, double )>(&bar::mf);
+ BOOST_ASSERT( f(&foo, 1.0) == 3 );
+ BOOST_ASSERT( f.empty<int (bar*, int )>() );
+
+ // if you try to compile the following line of code:
+ // f.set<int (bar*, int )>(&bar::mf);
+ // you get a compiler error, because the call signature
+ // syntax is not able to disambiguate between two member
+ // functions that differ for the const qualifier only
+
+
+ // in order to set a pointer to the non-const qualified
+ // version of bar::mf as object target
+ // for the int (bar*, int ) call signature of the overload
+ // object f, you can utilize a special variant of
+ // the call signature syntax
+ using boost::overloads::non_const;
+ f.set<int (bar*, int ), non_const>(&bar::mf);
+ // now foo.mf(int ) is invoked
+ BOOST_ASSERT( f(&foo, 1) == 1 );
+
+ // what if I want to set a pointer to
+ // the const qualified version of boost::mf as object
+ // target for the int (bar*, int ) call signature of
+ // the overload object f ?
+
+ // first off, you should notice that the set up of such
+ // a target is semantically correct because the explicit
+ // call signature of the const qualified bar::mf function
+ // member is int (const bar*, int ) and we can always pass
+ // a T* argument where a const T* is expected.
+
+ // as above you can utilize the special variant of the call
+ // signature syntax
+ using boost::overloads::const_;
+ f.set<int (bar*, int ), const_>(&bar::mf);
+ // now foo.mf(int ) const is invoked
+ BOOST_ASSERT( f(&foo, 1) == 2 );
+
+
+
+ // you should notice that in case we have an overload
+ // object that supports the *const* qualified explicit call
+ // signature int (const bar*, int )
+ boost::overload<int (const bar*, int ),
+ int (bar*, std::string )> g;
+ // we can utilize the standard call signature based syntax
+ // because selecting the const qualified version of the
+ // bar::mf member function is the only semantically correct
+ // choice
+
+ // no compiler error here!
+ g.set<int (const bar*, int )>(&bar::mf);
+ // foo.mf(int ) const is invoked
+ BOOST_ASSERT( g(&foo, 1) == 2 );
+
+ // and if you try to compile the following line of code:
+ // g.set<int (const bar*, int ), non_const>(&bar::mf);
+ // you get a compiler error because you cannot pass a
+ // const T* argument where a T* is expected
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/statefull_polymorphic_function_object.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/statefull_polymorphic_function_object.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,63 @@
+/*=============================================================
+ Boost Overload
+ Example 11 - Using the set_for_each_shared_signature method
+ with a statefull polymorphic function object
+==============================================================*/
+
+//[ statefull_polymorphic_function_object_cpp
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+/* polymorphic function object */
+struct bar
+{
+ bar() : total_calls(0) {}
+
+ int operator()(int ) { ++total_calls; return -1; }
+
+ template<typename T>
+ int operator()(T ) { ++total_calls; return sizeof(T); }
+
+ int total_calls;
+};
+
+int main()
+{
+ boost::overload<int (int ), int (char )> f;
+
+ // function object
+ bar foo;
+ foo( 1 ); foo( 'x' );
+ BOOST_ASSERT( foo.total_calls == 2 );
+
+ f.set_for_each_shared_signature(foo);
+ f(1); f('x');
+ BOOST_ASSERT( foo.total_calls == 2 ); // not 4
+ // f.get<int (int )>() and f.get<double (double )>() are
+ // different boost::function instances that own two
+ // different copy of the foo function object
+ const bar* foo_copy_1 = f.get<int (int )>().target<bar>();
+ BOOST_ASSERT( foo_copy_1->total_calls == 3 ); // not 4
+ const bar* foo_copy_2 = f.get<int (char )>().target<bar>();
+ BOOST_ASSERT( foo_copy_2->total_calls == 3 ); // not 4
+
+ f.clear_all();
+ BOOST_ASSERT( f.empty_all() );
+ // foo.total_calls is still equal to 2
+
+ //
+ f.set_for_each_shared_signature( boost::ref(foo) );
+ f(1); f('x');
+ // f.get<int (int )>() and f.get<double (double )>()
+ // are different boost::function instances
+ // that own a reference to the same function object
+ BOOST_ASSERT( foo.total_calls == 4 );
+ const bar* foo_ref_1 = f.get<int (int )>().target<bar>();
+ BOOST_ASSERT( foo_ref_1->total_calls == 4 );
+ const bar* foo_ref_2 = f.get<int (char )>().target<bar>();
+ BOOST_ASSERT( foo_ref_2->total_calls == 4 );
+
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/type_traits.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/type_traits.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,84 @@
+/*=============================================================
+ Boost Overload
+ Example 11 - Boost.Overload type traits
+==============================================================*/
+
+//[ type_traits_cpp
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/overload.hpp>
+
+using namespace boost::overloads;
+using boost::is_same;
+
+
+int foo(long ) { return 1; }
+typedef int (*foo_ptr)(long );
+
+struct bar
+{
+ int operator()(double ) { return -1; }
+};
+
+
+typedef boost::overload<int (int ), int (char ), int (double )>
+ overload_type;
+
+
+BOOST_STATIC_ASSERT(( extent<overload_type>::value == 3 ));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ signature<overload_type, 0>::type,
+ int (int )
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ function<overload_type, 1>::type,
+ boost::function<int (char )>
+ >::value
+));
+
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<overload_type, int (double )>::value == 2 ));
+
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<overload_type, int (float )>::value == -1 ));
+
+BOOST_STATIC_ASSERT(( has_signature<overload_type, int( char)>::value ));
+
+BOOST_STATIC_ASSERT(( !has_signature<overload_type, int( long)>::value ));
+
+BOOST_STATIC_ASSERT(( have_any_shared_signature<overload_type, bar>::value ));
+
+BOOST_STATIC_ASSERT(( !have_any_shared_signature<overload_type, foo_ptr>::value ));
+
+
+
+typedef boost::function<int(double)> function_type;
+
+
+BOOST_STATIC_ASSERT(( extent<function_type>::value == 1 ));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ signature<function_type>::type,
+ int (double )
+ >::value
+));
+
+BOOST_STATIC_ASSERT(( has_signature<function_type, int (double )>::value ));
+BOOST_STATIC_ASSERT(( !has_signature<function_type, int (char )>::value ));
+
+BOOST_STATIC_ASSERT(( have_any_shared_signature<function_type, bar>::value ));
+BOOST_STATIC_ASSERT(( !have_any_shared_signature<function_type, foo_ptr>::value ));
+//]
+
+
+int main()
+{
+ return boost::report_errors();
+}
+

Added: sandbox/overload/trunk/libs/overload/examples/use_case_variant_visitor.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/use_case_variant_visitor.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,49 @@
+/*==============================================================
+ Boost Overload
+ Use case - Variant visitor
+==============================================================*/
+
+//[ use_case_variant_visitor_cpp
+#include <boost/variant.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+template<typename Overload, typename R = ::boost::detail::static_visitor_default_return>
+struct overloaded_visitor : public Overload
+{
+ typedef R result_type;
+};
+
+
+
+int apply_to_int(int )
+{
+ return 1;
+}
+
+int apply_to_string(const std::string & )
+{
+ return 2;
+}
+
+
+typedef boost::overload<int (int ), int(const std::string & )> overload_type;
+
+typedef overloaded_visitor<overload_type, int> visitor_type;
+
+
+int main()
+{
+
+ boost::variant< int, std::string > u("hello world");
+
+ visitor_type my_visitor;
+ my_visitor.set( &apply_to_int, &apply_to_string );
+
+ int result = boost::apply_visitor( my_visitor, u );
+ BOOST_ASSERT( result == 2 );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/using_boost_function.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/using_boost_function.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,55 @@
+/*=============================================================
+ Boost Overload
+ Example 3 - Using Boost.Function
+==============================================================*/
+
+//[ using_boost_function_cpp
+#include <string>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+/* a free function */
+int foo(std::string )
+{
+ return 1;
+}
+typedef int signature1_t (std::string );
+
+/* a function object type */
+struct FuncObj
+{
+ int operator() (int, char ) const
+ {
+ return 2;
+ }
+};
+typedef int signature2_t (int, char );
+
+
+int main()
+{
+ // boost::function object that set foo as object target
+ boost::function<signature1_t> foo_wrapper(&foo);
+
+ // instance of FuncObj
+ FuncObj func_obj;
+
+
+ // overload object
+ boost::overload<signature1_t, signature2_t> f;
+
+ // a copy of the object target held by foo_wrapper
+ // is created and tied to the first call signature
+ f.set(foo_wrapper);
+
+ // set a copy of func_obj as object target
+ // for the second call signature
+ f.set(func_obj);
+
+ BOOST_ASSERT( f("hello") == 1 );
+ BOOST_ASSERT( f(1, 'x') == 2 );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/using_function_objects.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/using_function_objects.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,74 @@
+/*=============================================================
+ Boost Overload
+ Example 2 - Using function objects
+==============================================================*/
+
+//[ using_function_objects_cpp
+#include <string>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+/* a free function */
+int foo(std::string )
+{
+ return 1;
+}
+typedef int signature1_t (std::string );
+
+/* a function object type */
+struct FuncObj1
+{
+ int operator() (int, char ) const
+ {
+ return 2;
+ }
+};
+typedef int signature2_t (int, char );
+
+/* a statefull function object type */
+struct FuncObj2
+{
+ FuncObj2() : calls(0) {}
+
+ int operator() (char )
+ {
+ ++calls;
+ return 3;
+ }
+ unsigned int calls;
+};
+typedef int signature3_t (char );
+
+
+int main()
+{
+ // an overload object that supports
+ // all the above call signatures
+ boost::overload<signature1_t, signature2_t, signature3_t> f;
+
+ // set a pointer to foo as target object tied to
+ // the first call signature
+ f.set(&foo);
+
+ FuncObj1 func_obj_1;
+ // func_obj_1 is cloned to an internal function
+ // object tied to the matching call signature
+ f.set(func_obj_1);
+
+ // if cloning is too expensive (e.g. your function object is
+ // statefull) or semantically incorrect you can wrap
+ // a function object with boost::ref
+ FuncObj2 func_obj_2;
+ f.set(boost::ref(func_obj_2));
+ // no copy occurs, only a reference to func_obj_2 is kept.
+
+ BOOST_ASSERT( f("hello") == 1 );
+ BOOST_ASSERT( f(1, 'x') == 2 );
+ BOOST_ASSERT( f('x') == 3 );
+ // we keep only a reference
+ BOOST_ASSERT( func_obj_2.calls == 1 );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/examples/using_member_functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/examples/using_member_functions.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,55 @@
+/*=============================================================
+ Boost Overload
+ Example 4 - Using member functions
+==============================================================*/
+
+//[ using_member_functions_cpp
+#include <string>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/overload.hpp>
+
+
+/* a free function */
+int foo(std::string )
+{
+ return 1;
+}
+typedef int signature1_t (std::string );
+
+/* a member function */
+class Alpha
+{
+ public:
+ Alpha(int _offset) : offset(_offset) {}
+
+ int code(char c)
+ {
+ if( c < 'a' || c > 'z' )
+ return -1;
+ return ( (c - 'a') + offset ) % 26;
+ }
+
+ private:
+ int offset;
+};
+// member function explicit non-const signature
+typedef int signature2_t (Alpha*, char );
+
+
+int main()
+{
+ Alpha alpha(3);
+
+ boost::overload<signature1_t, signature2_t> f;
+
+ f.set(&foo);
+ // we pass a pointer to the member fuction Alpha::code
+ f.set(&Alpha::code);
+
+ BOOST_ASSERT( f("hello") == 1 );
+ // invokes alpha.code('x')
+ BOOST_ASSERT( f(&alpha, 'x') == 0 );
+
+ return boost::report_errors();
+}
+//]

Added: sandbox/overload/trunk/libs/overload/tests/Jamfile.jam
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/Jamfile.jam 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,9 @@
+# Copyright 2012 (c) Marco Cecchetti
+# Released under the Boost Software License Version 1.0
+# See http://boost.org/LICENSE_1_0.txt for full license text.
+
+using testing ;
+
+
+unit-test initial_test : test.cpp ;
+

Deleted: sandbox/overload/trunk/libs/overload/tests/Jamfile.v2
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/Jamfile.v2 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
+++ (empty file)
@@ -1,16 +0,0 @@
-# Copyright 2007 (c) Dean Michael Berris, Marco Cecchetti
-# Released under the Boost Software License Version 1.0
-# See http://boost.org/LICENSE_1_0.txt for full license text.
-
-import modules ;
-
-local BOOST_DIR = [ modules.peek : BOOST_ROOT ] ;
-
-project overload/tests
- : requirements
- <include>../../../
- <include>$(BOOST_DIR)
- ;
-
-unit-test initial_test : test.cpp ;
-

Modified: sandbox/overload/trunk/libs/overload/tests/test.cpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test.cpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test.cpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -7,7 +7,7 @@
 #include <boost/static_assert.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-
+#define BOOST_OVERLOAD_ENABLE_LAMBDA_SUPPORT
 #include <boost/overload.hpp>
 
 #include "test/functors.hpp"
@@ -23,17 +23,45 @@
 #include "test/trait_by_index.hpp"
 #include "test/trait_by_signature.hpp"
 #include "test/trait_by_functor.hpp"
+#include "test/metafunctions.hpp"
+#include "test/get_signature.hpp"
 #include "test/signature_deduction.hpp"
 #include "test/idx_and_sig_methods.hpp"
 #include "test/free_and_member_functions.hpp"
 #include "test/signature_with_ptr_ref.hpp"
+#include "test/set_target.hpp"
+#include "test/compatible_signatures.hpp"
+#include "test/function_object_with_state.hpp"
+#include "test/assignment.hpp"
+#include "test/contains.hpp"
+#include "test/test_target.hpp"
+#include "test/as_functor.hpp"
+#include "test/make_overload.hpp"
+#include "test/result.hpp"
+#include "test/lambda_result_type_support.hpp"
+#include "test/bind_and_lambda.hpp"
+
+
 
 int main()
 {
- test05();
- test06();
- test07();
- test08();
+
+ signature_deduction_test();
+ index_and_signature_methods_test();
+ free_and_member_overloaded_functions_test();
+ signature_with_ptr_and_ref_test();
+ set_target_test();
+ compatible_signature_test();
+ func_object_with_state_test();
+ assignment_test();
+ contains_test();
+ test_target_test();
+ as_functor_test();
+ make_overload_test();
+ lambda_support_test();
+ lambda_test();
+ bind_test();
+
     return boost::report_errors();
 }
 

Added: sandbox/overload/trunk/libs/overload/tests/test/as_functor.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/as_functor.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,102 @@
+
+#ifndef _TEST_AS_FUNCTOR_HPP_
+#define _TEST_AS_FUNCTOR_HPP_
+
+
+void as_functor_test()
+{
+ typedef boost::overload<sig1_t, sig2_t, sig3_t> polymorfic1_t;
+ typedef boost::overload<sig0_t, sig5_t, sig3_t, sig4_t> polymorfic2_t;
+ typedef boost::overload<sig0_t, sig2_t, sig3_t, sig4_t> polymorfic3_t;
+ typedef boost::overload<sig0_t, sig5_t, sig4_t> polymorfic4_t;
+
+
+ BOOST_STATIC_ASSERT((
+ is_same< ovdtl::get_function_tag<polymorfic1_t>::type,
+ ovdtl::function_obj_tag
+ >::value
+ ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::functor_has_signature<polymorfic1_t, sig2_t>::value ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::number_of_shared_signatures<polymorfic1_t, polymorfic2_t>
+ ::value == 1 ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::have_any_shared_signature<polymorfic1_t, polymorfic2_t>::value ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::number_of_shared_signatures<polymorfic1_t, polymorfic3_t>
+ ::value == 2 ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::have_any_shared_signature<polymorfic1_t, polymorfic3_t>::value ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::number_of_shared_signatures<polymorfic1_t, polymorfic4_t>
+ ::value == 0 ));
+
+ BOOST_STATIC_ASSERT((
+ !ovdtl::have_any_shared_signature<polymorfic1_t, polymorfic4_t>::value ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::number_of_shared_signatures<polymorfic3_t, polymorfic4_t>
+ ::value == 2 ));
+
+ BOOST_STATIC_ASSERT((
+ ovdtl::have_any_shared_signature<polymorfic3_t, polymorfic4_t>::value ));
+
+
+ polymorfic1_t f;
+ f.set( &bar1::foo1 );
+ f.set( &bar2::foo2 );
+ f.set( &foo3 );
+ BOOST_ASSERT( f("hello") == 'Y' );
+
+ polymorfic2_t g;
+ g.set( f );
+ BOOST_ASSERT( g("hello") == 'Y' );
+ BOOST_ASSERT( g.empty<0>() );
+ BOOST_ASSERT( g.empty<1>() );
+ BOOST_ASSERT( g.empty<3>() );
+
+ polymorfic3_t h;
+ h.set<sig2_t>( f );
+ h.set<sig3_t>( f );
+ BOOST_ASSERT( h.empty<0>() );
+ BOOST_ASSERT( !h.empty<1>() );
+ BOOST_ASSERT( !h.empty<2>() );
+ BOOST_ASSERT( h.empty<3>() );
+ BOOST_ASSERT( h("hello") == 'Y' );
+
+ h.clear_all();
+ BOOST_ASSERT( h.empty_all() );
+ h.set<1>( f );
+ h.set<2>( f );
+ BOOST_ASSERT( h.empty<0>() );
+ BOOST_ASSERT( !h.empty<1>() );
+ BOOST_ASSERT( !h.empty<2>() );
+ BOOST_ASSERT( h.empty<3>() );
+ BOOST_ASSERT( h("hello") == 'Y' );
+
+
+ // MSVC 7.1 doesn't succeed in deducing the signature of a multi-signature
+ // function object
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ polymorfic3_t p;
+ p.set_for_each_shared_signature( f );
+ BOOST_ASSERT( p.empty<0>() );
+ BOOST_ASSERT( !p.empty<1>() );
+ BOOST_ASSERT( !p.empty<2>() );
+ BOOST_ASSERT( p.empty<3>() );
+ BOOST_ASSERT( p("hello") == 'Y' );
+#endif
+
+}
+
+
+
+
+#endif /* _TEST_AS_FUNCTOR_HPP_ */

Added: sandbox/overload/trunk/libs/overload/tests/test/assignment.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/assignment.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,42 @@
+
+#ifndef _TEST_ASSIGNMENT_HPP_
+#define _TEST_ASSIGNMENT_HPP_
+
+
+void assignment_test()
+{
+
+ typedef boost::overload<int (int, int), int (int, std::string )> overload_type;
+
+ overload_type f;
+ f14_t f14;
+ f.set<0>(f14);
+ f.set<1>(f14);
+
+ overload_type g(f);
+ BOOST_ASSERT( g(1,1) == f(1, 1) );
+ BOOST_ASSERT( g(1, "hi") == f(1, "hi") );
+
+
+ overload_type h;
+ h = f;
+ BOOST_ASSERT( h(1,1) == f(1, 1) );
+ BOOST_ASSERT( h(1, "hi") == f(1, "hi") );
+
+ overload_type f2;
+ f2.set<int (int, int)>(&foo12);
+ f2.set<int (int, std::string )>(&foo12);
+ f.swap(f2);
+ BOOST_ASSERT( f(1,1) == 12 );
+ BOOST_ASSERT( f(1, "hello") == 122 );
+ BOOST_ASSERT( f2(1,1) == sizeof(int) );
+ BOOST_ASSERT( f2(1, "hello") == sizeof(std::string) );
+
+ boost::swap( f, f2);
+ BOOST_ASSERT( f2(1,1) == 12 );
+ BOOST_ASSERT( f2(1, "hello") == 122 );
+ BOOST_ASSERT( f(1,1) == sizeof(int) );
+ BOOST_ASSERT( f(1, "hello") == sizeof(std::string) );
+}
+
+#endif /* _TEST_ASSIGNMENT_HPP_ */

Added: sandbox/overload/trunk/libs/overload/tests/test/bind_and_lambda.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/bind_and_lambda.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,82 @@
+
+#ifndef _TEST_BIND_AND_LAMBDA_HPP_
+#define _TEST_BIND_AND_LAMBDA_HPP_
+
+
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+
+void lambda_test()
+{
+ using namespace boost::lambda;
+
+ boost::overload<int& (int& ), int (int, int )> f;
+ f.set<int& (int& )>( _1 += 10 );
+ f.set<int (int, int )>( _1 + _2 );
+ int m = 3, n = 2;
+ f(n);
+ BOOST_ASSERT( n == 12 );
+ BOOST_ASSERT( f(m, n) == 15 );
+
+ f.clear_all();
+ f.set<0>( _1 += 10 );
+ f.set<1>( _1 + _2 );
+ m = 3, n = 2;
+ f(n);
+ BOOST_ASSERT( n == 12 );
+ BOOST_ASSERT( f(m, n) == 15 );
+
+
+ boost::overload<int (char ), double (int, char )> ff;
+
+ bar1 b1;
+ bar2 b2;
+
+
+ ff.set<int (char )>( bind( &bar1::foo1, &b1, _1 ) );
+ ff.set<double (int, char )>( bind( &bar2::foo2, &b2, _1, _2 ) );
+
+ int out1 = ff('x');
+ double out2 = ff(123, 'x');
+
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+
+}
+
+#include <boost/bind.hpp>
+
+void bind_test()
+{
+ boost::overload<int (char ), double (int, char )> f;
+
+ bar1 b1;
+ bar2 b2;
+
+
+ f.set<int (char )>( boost::bind( &bar1::foo1, &b1, _1 ) );
+ f.set<double (int, char )>( boost::bind( &bar2::foo2, &b2, _1, _2 ) );
+
+ int out1 = f('x');
+ double out2 = f(123, 'x');
+
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+
+ f.clear_all();
+
+ f.set<0>( boost::bind( &bar1::foo1, &b1, _1 ) );
+ f.set<1>( boost::bind( &bar2::foo2, &b2, _1, _2 ) );
+
+ out1 = f('x');
+ out2 = f(123, 'x');
+
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+
+
+}
+
+
+#endif // _TEST_BIND_AND_LAMBDA_HPP_
+

Added: sandbox/overload/trunk/libs/overload/tests/test/compatible_signatures.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/compatible_signatures.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,144 @@
+
+#ifndef _TEST_COMPATIBLE_SIGNATURES_
+#define _TEST_COMPATIBLE_SIGNATURES_
+
+
+
+int goo1(int )
+{
+ return 1;
+}
+typedef int s1_t (int );
+
+
+int goo2(double )
+{
+ return 2;
+}
+typedef int s2_t (double );
+
+
+double goo3(int )
+{
+ return 3.0;
+}
+typedef double s3_t (int );
+
+
+int goo4(std::string )
+{
+ return 4;
+}
+typedef int s4_t (std::string );
+
+
+struct goo5
+{
+ template< typename T >
+ T operator()(T x)
+ {
+ return x;
+ }
+};
+
+
+double goo6(double )
+{
+ return 6;
+}
+
+
+
+
+void compatible_signature_test()
+{
+ boost::overload<int (std::string ), double (int )> f1;
+
+ f1.set<double (int )>( &goo1 );
+ BOOST_ASSERT( !f1.empty<double (int )>() );
+ BOOST_ASSERT( f1(10) == goo1(10) );
+
+ f1.set<double (int )>( goo5() );
+ BOOST_ASSERT( !f1.empty<double (int )>() );
+ BOOST_ASSERT( f1(10) == goo5()(10) );
+
+ f1.set<double (int )>( &goo2 );
+ BOOST_ASSERT( !f1.empty<double (int )>() );
+ BOOST_ASSERT( f1(10) == goo2(10.0) );
+
+
+ f1.clear_all();
+ BOOST_ASSERT( f1.empty_all() );
+
+ f1.set<1>( &goo1 );
+ BOOST_ASSERT( !f1.empty<1>() );
+ BOOST_ASSERT( f1(10) == goo1(10) );
+
+ f1.set<1>( goo5() );
+ BOOST_ASSERT( !f1.empty<1>() );
+ BOOST_ASSERT( f1(10) == goo5()(10) );
+
+ f1.set<1>( &goo2 );
+ BOOST_ASSERT( !f1.empty<1>() );
+ BOOST_ASSERT( f1(10) == goo2(10.0) );
+
+
+/*
+ boost::overload<int (std::string ), int (double )> f2;
+
+ // warning here: converting to 'int' from 'double'
+ f2.set<int (double )>( &goo1 );
+ BOOST_ASSERT( !f2.empty<int (double )>() );
+ BOOST_ASSERT( f2(10.0) == goo1(10) );
+
+ // warning here: converting to 'int' from 'double'
+ f2.set<int (double )>( goo5() );
+ BOOST_ASSERT( !f2.empty<int (double )>() );
+ BOOST_ASSERT( f2(10.0) == goo5()(10.0) );
+
+ // double warning here: converting to 'int' from 'double'
+ f2.set<int (double )>( &goo3 );
+ BOOST_ASSERT( !f2.empty<int (double )>() );
+ BOOST_ASSERT( f2(10.0) == goo3(10) );
+*/
+ // error here:
+ // invalid conversion from `int (*)(std::string)' to `int (*)(double)'
+ // f2.set<int (double )>( &goo4 );
+
+ // error here:
+ // boost static assertion failure:
+ // have_any_shared_signature<int (int), overload_type> evaluates to false
+ // f1.set( &goo1 );
+
+
+ boost::overload<double (double ), double (int )> f3;
+
+ f3.set<double (int )>( &goo6 );
+ BOOST_ASSERT( f3.empty<double (double )>() );
+ BOOST_ASSERT( !f3.empty<double (int )>() );
+ BOOST_ASSERT( f3(10) == goo6(10.0) );
+
+ f3.set<double (double )>( &goo2 );
+ BOOST_ASSERT( !f3.empty<double (double)>() );
+ BOOST_ASSERT( f3(10.0) == goo2(10) );
+ BOOST_ASSERT( f3(10) == goo6(10.0) );
+
+
+ f3.clear_all();
+ BOOST_ASSERT( f3.empty_all() );
+
+ f3.set<1>( &goo6 );
+ BOOST_ASSERT( f3.empty<0>() );
+ BOOST_ASSERT( !f3.empty<1>() );
+ BOOST_ASSERT( f3(10) == goo6(10.0) );
+
+ f3.set<0>( &goo2 );
+ BOOST_ASSERT( !f3.empty<0>() );
+ BOOST_ASSERT( f3(10.0) == goo2(10) );
+ BOOST_ASSERT( f3(10) == goo6(10.0) );
+
+}
+
+
+#endif // _TEST_COMPATIBLE_SIGNATURES_
+

Added: sandbox/overload/trunk/libs/overload/tests/test/contains.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/contains.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,83 @@
+
+#ifndef _TEST_CONTAINS_HPP_
+#define _TEST_CONTAINS_HPP_
+
+namespace contain_test {
+
+// this part is recycled from the boost function test code
+
+struct ReturnIntFE
+{
+ explicit ReturnIntFE(int value) : value(value) {}
+
+ int operator()() const { return value; }
+
+ int value;
+};
+
+}
+
+#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+namespace contain_test {
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+bool function_equal(const ReturnIntFE& x, const ReturnIntFE& y)
+{ return x.value == y.value; }
+# else
+bool function_equal_impl(const ReturnIntFE& x, const ReturnIntFE& y, int)
+{ return x.value == y.value; }
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+}
+#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+namespace boost {
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+bool
+function_equal(const contain_test::ReturnIntFE& x,
+ const contain_test::ReturnIntFE& y)
+{ return x.value == y.value; }
+# else
+bool
+function_equal_impl(const contain_test::ReturnIntFE& x,
+ const contain_test::ReturnIntFE& y, int)
+{ return x.value == y.value; }
+# endif
+}
+#endif
+
+
+void contains_test()
+{
+ using namespace contain_test;
+ boost::overload<sig0_t, sig1_t, int (), sig2_t> f;
+
+ // f0_t function pointer
+ // f1_t member function pointer
+ // f2_t member function pointer (with const)
+
+ ReturnIntFE this_return_ten(10);
+
+ f.set( &foo0, &bar1::foo1, this_return_ten, &bar2::foo2 );
+
+ BOOST_ASSERT( f.get<0>().target<f0_t>() );
+ BOOST_ASSERT( *(f.get<0>().target<f0_t>()) == &foo0 );
+ BOOST_ASSERT( f.get<1>().target<f1_t>() );
+ BOOST_ASSERT( *(f.get<1>().target<f1_t>()) == &bar1::foo1 );
+ BOOST_ASSERT( f.get<3>().target<f2_t>() );
+ BOOST_ASSERT( *(f.get<3>().target<f2_t>()) == &bar2::foo2 );
+ BOOST_ASSERT( f.get<2>().target<ReturnIntFE>() );
+ BOOST_ASSERT( function_equal( *(f.get<2>().target<ReturnIntFE>()), this_return_ten ) );
+
+ BOOST_ASSERT( f.get<0>().contains( &foo0 ) );
+ BOOST_ASSERT( f.get<1>().contains( &bar1::foo1 ) );
+ BOOST_ASSERT( f.get<2>().contains( this_return_ten ) );
+ BOOST_ASSERT( f.get<3>().contains( &bar2::foo2 ) );
+
+ BOOST_ASSERT( f.contains( &foo0 ) );
+ BOOST_ASSERT( f.contains( &bar1::foo1 ) );
+ BOOST_ASSERT( f.contains( this_return_ten ) );
+ BOOST_ASSERT( f.contains( &bar2::foo2 ) );
+
+}
+
+
+#endif /* _TEST_CONTAINS_HPP_ */

Added: sandbox/overload/trunk/libs/overload/tests/test/detail/change_result_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/detail/change_result_type.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,41 @@
+/*=============================================================================
+ Copyright (c) 2007-2012 Marco Cecchetti
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef _BOOST_OVERLOAD_CHANGE_RESULT_TYPE_HPP_
+#define _BOOST_OVERLOAD_CHANGE_RESULT_TYPE_HPP_
+
+#include <boost/type_traits/function_traits.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// utility: change_result_type<ResultType, Signature>
+// requires: Signature is a function type (e.g. R (A0, A1, ...,AN))
+// returns: a call signature with the same parameter types of Signature and
+// with result type ResultType
+
+#define BOOST_OVERLOAD_CHANGE_RESULT_TYPE(z, n, unused) \
+template<typename ResultType, typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A) > \
+struct change_result_type<ResultType, R ( BOOST_PP_ENUM_PARAMS(n, A) )> \
+{ \
+ typedef ResultType type ( BOOST_PP_ENUM_PARAMS(n, A) ); \
+};
+// end macro BOOST_OVERLOAD_CHANGE_RESULT_TYPE
+
+namespace boost{ namespace overloads{ namespace detail{
+
+template<typename ResultType, typename Signature>
+struct change_result_type
+{};
+
+
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_OVERLOAD_MAX_NUM_ARGS), BOOST_OVERLOAD_CHANGE_RESULT_TYPE, unused)
+
+} } } // end namespaces
+
+#undef BOOST_OVERLOAD_CHANGE_RESULT_TYPE
+
+#endif // _BOOST_OVERLOAD_CHANGE_RESULT_TYPE_HPP_

Modified: sandbox/overload/trunk/libs/overload/tests/test/free_and_member_functions.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/free_and_member_functions.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/free_and_member_functions.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -3,7 +3,7 @@
 #define _TEST_FREE_AND_MEMBER_OVERLOADED_FUNCTIONS_HPP_
 
 
-void test07()
+void free_and_member_overloaded_functions_test()
 {
     typedef
         boost::overload<inc_int_sig_t, inc_float_sig_t,
@@ -29,7 +29,6 @@
     BOOST_ASSERT( f(&multi1, 1) == 2 );
 
 
-
     boost::overload<foo_int_const_sig_t, foo_float_sig_t> g;
 
     // uses "int foo(int ) const" because it's the only valid choice
@@ -48,10 +47,12 @@
     qui.set<sig1_t>(&bar1::foo1);
     qui.set<non_const_sig2_t>(&bar2::foo2);
     BOOST_ASSERT( qui(&b1, 'x') == 123 );
- BOOST_ASSERT( qui(&b2, 1, 'x') == 123.456 );
+ double d = qui(&b2, 1, 'x');
+ BOOST_ASSERT( d > 233.999 && d < 234.001 );
     qui.clear<non_const_sig2_t>();
     qui.set<non_const_sig2_t, ovld::const_>(&bar2::foo2);
- BOOST_ASSERT( qui(&b2, 1, 'x') == 123.456 );
+ d = qui(&b2, 1, 'x');
+ BOOST_ASSERT( d > 233.999 && d < 234.001 );
 
 
 
@@ -59,10 +60,12 @@
     quo.set<sig1_t>(&bar1::foo1);
     quo.set<sig2_t>(&bar2::foo2);
     BOOST_ASSERT( quo(&b1, 'x') == 123 );
- BOOST_ASSERT( quo(&b2, 1, 'x') == 123.456 );
+ d = quo(&b2, 1, 'x');
+ BOOST_ASSERT( d > 233.999 && d < 234.001 );
     quo.clear<sig2_t>();
     quo.set<sig2_t, ovld::const_>(&bar2::foo2);
- BOOST_ASSERT( quo(&b2, 1, 'x') == 123.456 );
+ d = quo(&b2, 1, 'x');
+ BOOST_ASSERT( d > 233.999 && d < 234.001 );
 
 
 
@@ -80,6 +83,50 @@
     duck.set<int (bar13*, int, std::string )>(&bar13::foo13);
     BOOST_ASSERT( duck(&b13, 1, 1) == 13 );
     BOOST_ASSERT( duck(&b13, 1, std::string("hi")) == 133 );
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // set<N> tests
+
+ f.clear_all();
+ BOOST_ASSERT( f.empty_all() );
+
+ f.set<0>(&inc); // uses "int inc(int )"
+ f.set<1>(&inc); // uses "float inc(float )"
+ f.set<3>(&multi::foo); // uses "float foo(std::string )"
+
+ BOOST_ASSERT( f(1) == 2 );
+ BOOST_ASSERT( f(2.0f) == 3.0f );
+ BOOST_ASSERT( f(&multi1, "hi") == 3.0f );
+
+
+ qui.clear_all();
+ BOOST_ASSERT( qui.empty_all() );
+
+ qui.set<0>(&bar1::foo1);
+ qui.set<1>(&bar2::foo2);
+ BOOST_ASSERT( qui(&b1, 'x') == 123 );
+ d = qui(&b2, 1, 'x');
+ BOOST_ASSERT( d > 233.999 && d < 234.001 );
+
+
+ qua.clear_all();
+ BOOST_ASSERT( qua.empty_all() );
+
+ qua.set<1>(&foo12);
+ qua.set<0>(&foo12);
+ BOOST_ASSERT( qua(1, 1) == 12 );
+ BOOST_ASSERT( qua(1, std::string("hi")) == 122 );
+
+
+ duck.clear_all();
+ BOOST_ASSERT( duck.empty_all() );
+
+ duck.set<0>(&bar13::foo13);
+ duck.set<1>(&bar13::foo13);
+ BOOST_ASSERT( duck(&b13, 1, 1) == 13 );
+ BOOST_ASSERT( duck(&b13, 1, std::string("hi")) == 133 );
+
 }
 
 

Added: sandbox/overload/trunk/libs/overload/tests/test/function_object_with_state.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/function_object_with_state.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,75 @@
+
+#ifndef _TEST_FUNCTION_OBJECT_WITH_STATE_
+#define _TEST_FUNCTION_OBJECT_WITH_STATE_
+
+namespace ns_func_object_with_state_test
+{
+
+struct bar
+{
+ bar() : calls(0) {}
+
+ template< typename T >
+ T operator()(T x)
+ {
+ ++calls;
+ return x;
+ }
+
+ int calls;
+};
+
+void func_object_with_state_test()
+{
+ bar foo;
+
+ foo( 1 );
+ foo( "hello" );
+ BOOST_ASSERT( foo.calls == 2 );
+
+ boost::overload<std::string (std::string ), int (int )> f1;
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ f1.set<std::string (std::string )>( foo );
+ f1.set<int (int )>( foo );
+#else
+ f1.set_for_each_shared_signature( foo );
+#endif
+
+ f1( 1 );
+ f1( "hello" );
+
+ BOOST_ASSERT( f1.get<std::string (std::string )>().target<bar>() );
+ BOOST_ASSERT( f1.get<std::string (std::string )>().target<bar>()->calls == 3 );
+ BOOST_ASSERT( f1.get<int (int )>().target<bar>() );
+ BOOST_ASSERT( f1.get<int (int )>().target<bar>()->calls == 3 );
+ BOOST_ASSERT( foo.calls == 2 );
+
+ f1.clear_all();
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ f1.set<std::string (std::string )>( boost::ref(foo) );
+ f1.set<int (int )>( boost::ref(foo) );
+#else
+ f1.set_for_each_shared_signature( boost::ref(foo) );
+#endif
+
+ f1( 1 );
+ f1( "hello" );
+
+// For intel compilers 9.1 and 10.0 the target method returns NULL pointers
+#if !BOOST_WORKAROUND(__INTEL_COMPILER, < 1010) && ! __clang__
+ BOOST_ASSERT( f1.get<std::string (std::string )>().target<bar>() );
+ BOOST_ASSERT( f1.get<std::string (std::string )>().target<bar>()->calls == 4 );
+ BOOST_ASSERT( f1.get<int (int )>().target<bar>() );
+ BOOST_ASSERT( f1.get<int (int )>().target<bar>()->calls == 4 );
+#endif
+ BOOST_ASSERT( foo.calls == 4 );
+
+}
+
+} // end namespace ns_func_object_with_state_test
+
+using ns_func_object_with_state_test::func_object_with_state_test;
+
+#endif // TEST_FUNCTION_OBJECT_WITH_STATE_
+

Modified: sandbox/overload/trunk/libs/overload/tests/test/functors.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/functors.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/functors.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -4,16 +4,15 @@
 
 
 #include <string>
-#include <iostream>
 #include <boost/function.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
-void foo0(std::string s1, std::string s2, std::string s3)
+int foo0(std::string , std::string , std::string )
 {
- std::cout << s1 << s2 << s3 << std::endl;
+ return 12;
 }
 
-typedef void sig0_t (std::string , std::string , std::string );
+typedef int sig0_t (std::string , std::string , std::string );
 typedef sig0_t* f0_t;
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -33,7 +32,7 @@
 {
     double foo2(int, char ) const
     {
- return 123.456;
+ return 234.0;
     }
 };
 
@@ -43,7 +42,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 char foo3(std::string )
 {
- return 'x';
+ return 'Y';
+}
+
+char foo3b(std::string )
+{
+ return 'Z';
 }
 
 typedef char sig3_t (std::string );
@@ -55,7 +59,7 @@
 {
     int operator() (char )
     {
- return 123;
+ return 456;
     }
 };
 
@@ -67,7 +71,7 @@
 {
     double operator() (int, char ) const
     {
- return 123.456;
+ return 567.0;
     }
 };
 
@@ -77,33 +81,33 @@
 ///////////////////////////////////////////////////////////////////////////////
 struct foo6
 {
- double operator() (float x)
+ double operator() (float )
     {
- return x + 1;
+ return 6781.0;
     }
 
- double operator() (float x, float y)
+ double operator() (float , float )
     {
- return x + y;
+ return 6782.0;
     }
 };
 
-typedef double sig6_t (float );
-typedef double sig7_t (float, float );
+typedef double sig6_1_t (float );
+typedef double sig6_2_t (float, float );
 typedef foo6 f6_t;
 
 ///////////////////////////////////////////////////////////////////////////////
 struct foo7
 {
     template<typename T>
- T operator()(T x)
+ T operator()(T )
     {
- return x + 1;
+ return (789 + sizeof(T));
     }
 };
 
-typedef int sig8_t (int );
-typedef double sig9_t (double );
+typedef int sig7_1_t (int );
+typedef double sig7_2_t (double );
 typedef foo7 f7_t;
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -112,37 +116,37 @@
     return 8;
 }
 
-typedef int sig10_t (double& );
-typedef sig10_t* f8_t;
+typedef int sig8_t (double& );
+typedef sig8_t* f8_t;
 
 ///////////////////////////////////////////////////////////////////////////////
 struct bar9
 {
- int foo9( double** )
+ int foo9_1( double** )
     {
         return 9;
     }
 
- int foo10( double* const& ) const
+ int foo9_2( double* const& ) const
     {
         return 10;
     }
 };
-typedef int sig11_t (bar9*, double** );
-typedef int (bar9::* f9_t) (double** );
-typedef int sig12_t (bar9*, double* const& );
-typedef int (bar9::* f10_t) (const double* & ) const;
+typedef int sig9_1_t (bar9*, double** );
+typedef int (bar9::* f9_1_t) (double** );
+typedef int sig9_2_t (bar9*, double* const& );
+typedef int (bar9::* f9_2_t) (const double* & ) const;
 
 ///////////////////////////////////////////////////////////////////////////////
-struct bar11
+struct bar10
 {
- int foo11( double** ) const
+ int foo10( double** ) const
     {
         return 11;
     }
 };
-typedef int sig13_t (bar11*, double** );
-typedef int (bar11::* f11_t) ( double** ) const;
+typedef int sig10_t (bar10*, double** );
+typedef int (bar10::* f10_t) ( double** ) const;
 
 ///////////////////////////////////////////////////////////////////////////////
 int foo12(int, int )

Added: sandbox/overload/trunk/libs/overload/tests/test/get_signature.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/get_signature.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,65 @@
+
+#ifndef _TEST_GET_SIGNATURE_HPP_
+#define _TEST_GET_SIGNATURE_HPP_
+
+
+#include<boost/overload/detail/get_signature.hpp>
+
+namespace get_signature_test_ns {
+
+
+// pointer to function
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f0_t>::type,
+ sig0_t
+ >::value ));
+// pointer to member function
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f1_t>::type,
+ sig1_t
+ >::value ));
+// pointer to const member function
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f2_t>::type,
+ sig2_t
+ >::value ));
+// boost::function
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f3_t>::type,
+ sig3_t
+ >::value ));
+// function object type
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f4_t>::type,
+ sig4_t
+ >::value ));
+// function object type (operator() const)
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f5_t>::type,
+ sig5_t
+ >::value ));
+// boost::reference_wrapper
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature< boost::reference_wrapper<f4_t> >::type,
+ sig4_t
+ >::value ));
+// boost::reference_wrapper (operator() const)
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature< boost::reference_wrapper<f5_t> >::type,
+ sig5_t
+ >::value ));
+// pointer to member function
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::get_signature<f9_1_t>::type,
+ sig9_1_t
+ >::value ));
+// pointer to const member function
+BOOST_STATIC_ASSERT(( !is_same<
+ ovdtl::get_signature<f9_2_t>::type,
+ sig9_2_t
+ >::value ));
+
+} // namespace get_signature_test_ns
+
+
+#endif /* _TEST_GET_SIGNATURE_HPP_ */

Modified: sandbox/overload/trunk/libs/overload/tests/test/idx_and_sig_methods.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/idx_and_sig_methods.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/idx_and_sig_methods.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -2,16 +2,17 @@
 #ifndef TEST_IDX_AND_SIG_METHODS_HPP
 #define TEST_IDX_AND_SIG_METHODS_HPP
 
-void test06()
+void index_and_signature_methods_test()
 {
     typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t,
- sig5_t, sig6_t, sig7_t, sig8_t, sig9_t>
+ sig5_t, sig6_1_t, sig6_2_t, sig7_1_t, sig7_2_t>
             overload_type;
 
     f0_t f0 = &foo0; // function pointer
     f1_t f1 = &bar1::foo1; // member function pointer
     f2_t f2 = &bar2::foo2; // member function pointer (with const)
     f3_t f3 = &foo3; // boost::function
+ f3_t f3b = &foo3b; // same signature (swap test)
     f4_t f4; // function object
     f5_t f5; // function object (with const)
     f6_t f6; // overloaded function object
@@ -21,45 +22,81 @@
 
     overload_type f;
 
- f.set<0>(f0);
+ f.set<sig0_t>(f0);
     f.set<sig1_t>(f1);
- f.set<5>(f5).set<3>(f3).set<sig4_t>(f4).set<2>(f2);
- f.set<sig6_t>(f6).set<7>(f6);
- f.set<sig9_t>(f7).set<sig8_t>(f7);
-
- f( "Hi", ", ", "people !" );
-
- int i = f(&b1, 'x');
- double d1 = f(&b2, 123, 'x');
- char c = f("hello");
- int j = f('x');
- double d2 = f(123, 'x');
- double d3 = f(2.5f);
- double d4 = f(3.0f, 4.0f);
- int k = f(1);
- double d5 = f(2.5);
-
- BOOST_ASSERT(i == 123);
- BOOST_ASSERT(d1 > 123.455 && d1 < 123.457);
- BOOST_ASSERT(c == 'x');
- BOOST_ASSERT(j == 123);
- BOOST_ASSERT(d2 > 123.455 && d2 < 123.457);
- BOOST_ASSERT(d3 == 3.5);
- BOOST_ASSERT(d4 == 7.0);
- BOOST_ASSERT(k == 2);
- BOOST_ASSERT(d5 == 3.5);
+ f.set<sig5_t>(f5).set<sig3_t>(f3).set<sig4_t>(f4).set<sig2_t>(f2);
+ f.set<sig6_1_t>(f6).set<sig6_2_t>(f6);
+ f.set<sig7_2_t>(f7).set<sig7_1_t>(f7);
+
+ {
+ int out0 = f( "Hi", ", ", "people !" );
+ int out1 = f(&b1, 'x');
+ double out2 = f(&b2, 123, 'x');
+ char out3 = f("hello");
+ int out4 = f('x');
+ double out5 = f(123, 'x');
+ double out61 = f(2.5f);
+ double out62 = f(3.0f, 4.0f);
+ int out71 = f(1);
+ double out72 = f(2.5);
+
+ BOOST_ASSERT(out0 == 12);
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+ BOOST_ASSERT(out3 == 'Y');
+ BOOST_ASSERT(out4 == 456);
+ BOOST_ASSERT(out5 > 566.999 && out5 < 567.001);
+ BOOST_ASSERT(out61 > 6780.999 && out61 < 6781.001);
+ BOOST_ASSERT(out62 > 6781.999 && out62 < 6782.001);
+ BOOST_ASSERT(out71 == (789 + sizeof(int)));
+ BOOST_ASSERT(out72 > (788.999 + sizeof(double)) &&
+ out72 < (789.001 + sizeof(double)));
+ }
+
+ f.clear_all();
+ BOOST_ASSERT( f.empty_all() );
 
+ f.set<0>(f0);
+ f.set<1>(f1);
+ f.set<5>(f5).set<3>(f3).set<4>(f4).set<2>(f2);
+ f.set<6>(f6).set<7>(f6);
+ f.set<8>(f7).set<9>(f7);
+
+ {
+ int out0 = f( "Hi", ", ", "people !" );
+ int out1 = f(&b1, 'x');
+ double out2 = f(&b2, 123, 'x');
+ char out3 = f("hello");
+ int out4 = f('x');
+ double out5 = f(123, 'x');
+ double out61 = f(2.5f);
+ double out62 = f(3.0f, 4.0f);
+ int out71 = f(1);
+ double out72 = f(2.5);
+
+ BOOST_ASSERT(out0 == 12);
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+ BOOST_ASSERT(out3 == 'Y');
+ BOOST_ASSERT(out4 == 456);
+ BOOST_ASSERT(out5 > 566.999 && out5 < 567.001);
+ BOOST_ASSERT(out61 > 6780.999 && out61 < 6781.001);
+ BOOST_ASSERT(out62 > 6781.999 && out62 < 6782.001);
+ BOOST_ASSERT(out71 == (789 + sizeof(int)));
+ BOOST_ASSERT(out72 > (788.999 + sizeof(double)) &&
+ out72 < (789.001 + sizeof(double)));
+ }
 
     f.clear<sig0_t>(); // same as f.clear<0>()
     BOOST_ASSERT( f.empty<sig0_t>() ); // same as f.empty<0>()
 
- boost::function<sig0_t> g(f0);
+ boost::function<sig3_t> g(f3b);
     f.swap_function(g);
- f("I'm ", "back ", "again !");
- BOOST_ASSERT( g.empty() );
+ BOOST_ASSERT(f("hello") == 'Z');
+ BOOST_ASSERT(g("hello") == 'Y');
 
- g = f.get<sig0_t>(); // same as f.get<0>()
- g("That's ", "all ", "folks !");
+ g = f.get<sig3_t>(); // same as f.get<3>()
+ BOOST_ASSERT(g("hello") == 'Z');
 
 }
 

Added: sandbox/overload/trunk/libs/overload/tests/test/lambda_result_type_support.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/lambda_result_type_support.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,49 @@
+
+#ifndef _TEST_LAMBDA_RESULT_TYPE_SUPPORT_HPP_
+#define _TEST_LAMBDA_RESULT_TYPE_SUPPORT_HPP_
+
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+
+
+void lambda_support_test()
+{
+ using namespace boost::lambda;
+
+ typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t, sig5_t>
+ overload_type;
+
+
+ f0_t f0 = &foo0; // function pointer
+ f1_t f1 = &bar1::foo1; // member function pointer
+ f2_t f2 = &bar2::foo2; // member function pointer (with const)
+ f3_t f3 = &foo3; // boost::function
+ f3_t f3b = &foo3b; // same signature (swap test)
+ f4_t f4; // function object
+ f5_t f5; // function object (with const)
+
+ bar1 b1; bar2 b2;
+
+ overload_type f( f0, f1, f2, f3, f4, f5 );
+
+ // do not work with the following compilers
+ // no Boost.Lambda support for the sig struct ?
+#if !( BOOST_WORKAROUND(__INTEL_COMPILER, < 1210) || BOOST_WORKAROUND(BOOST_MSVC, < 1400) )
+
+ std::string hello("hello");
+ BOOST_ASSERT( boost::lambda::bind(f, hello, hello, _1)(hello) == f(hello, hello, hello) );
+ BOOST_ASSERT( boost::lambda::bind(f, &b1, _1)('x') == f(&b1, 'x') );
+ BOOST_ASSERT( boost::lambda::bind(f, static_cast<const bar2*>(&b2), _1, _2)(1, 'x') == f(&b2, 1, 'x') );
+ BOOST_ASSERT( boost::lambda::bind(f, hello)() == f(hello) );
+ BOOST_ASSERT( boost::lambda::bind(f, _1)(hello) == f(hello) );
+ BOOST_ASSERT( boost::lambda::bind(f, _1)('x') == f('x') );
+ BOOST_ASSERT( boost::lambda::bind(f, _1, 'x')(1) == f(1, 'x') );
+
+#endif
+ //boost::lambda::bind(f, &b1, _1)('x');
+
+}
+
+
+
+#endif // _TEST_LAMBDA_RESULT_TYPE_SUPPORT_HPP_

Added: sandbox/overload/trunk/libs/overload/tests/test/make_overload.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/make_overload.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,51 @@
+
+#ifndef _TEST_MAKE_OVERLOAD_HPP_
+#define _TEST_MAKE_OVERLOAD_HPP_
+
+#include <boost/overload/make_overload.hpp>
+
+namespace make_overload_test_ns {
+typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t, sig5_t>
+ overload_type;
+
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::make_overload_type<f0_t, f1_t, f2_t, f3_t, f4_t, boost::reference_wrapper<f5_t> >::type,
+ overload_type>::value
+ ));
+
+} // end namespace make_overload_test_ns
+
+
+void make_overload_test()
+{
+ using make_overload_test_ns::overload_type;
+
+ bar1 b1;
+ bar2 b2;
+ f3_t f3 = &foo3; // boost::function
+ f4_t f4; // function object
+ f5_t f5; // function object (with const)
+
+
+ overload_type f =
+ boost::make_overload( &foo0, &bar1::foo1, &bar2::foo2,
+ f3, f4, boost::ref(f5) );
+
+ int out0 = f( "Hello", ", ", "world !" );
+ int out1 = f(&b1, 'x');
+ double out2 = f(&b2, 123, 'x');
+ char out3 = f("hello");
+ int out4 = f('x');
+ double out5 = f(123, 'x');
+
+ BOOST_ASSERT(out0 == 12);
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+ BOOST_ASSERT(out3 == 'Y');
+ BOOST_ASSERT(out4 == 456);
+ BOOST_ASSERT(out5 > 566.999 && out5 < 567.001);
+
+}
+
+#endif // _TEST_MAKE_OVERLOAD_HPP_

Added: sandbox/overload/trunk/libs/overload/tests/test/metafunctions.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/metafunctions.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,110 @@
+
+#ifndef _TEST_METAFUNCTIONS_HPP_
+#define _TEST_METAFUNCTIONS_HPP_
+
+
+namespace metafunction_test_ns {
+
+using namespace boost::overloads;
+
+
+int foo(long ) { return 1; }
+typedef int (*foo_ptr)(long );
+
+struct bar
+{
+ int operator()(double ) { return -1; }
+};
+
+
+typedef boost::overload<int (int ), int (char ), int (double )>
+ overload_type;
+
+
+BOOST_STATIC_ASSERT(( extent<overload_type>::value == 3 ));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ signature<overload_type, 0>::type,
+ int (int )
+ >::value
+));
+BOOST_STATIC_ASSERT((
+ is_same<
+ signature<overload_type, 1>::type,
+ int (char )
+ >::value
+));
+BOOST_STATIC_ASSERT((
+ is_same<
+ signature<overload_type, 2>::type,
+ int (double )
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ function<overload_type, 0>::type,
+ boost::function<int (int )>
+ >::value
+));
+BOOST_STATIC_ASSERT((
+ is_same<
+ function<overload_type, 1>::type,
+ boost::function<int (char )>
+ >::value
+));
+BOOST_STATIC_ASSERT((
+ is_same<
+ function<overload_type, 2>::type,
+ boost::function<int (double )>
+ >::value
+));
+
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<overload_type, int (int )>::value == 0 ));
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<overload_type, int (char )>::value == 1 ));
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<overload_type, int (double )>::value == 2 ));
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<overload_type, int (float )>::value == -1 ));
+
+BOOST_STATIC_ASSERT(( has_signature<overload_type, int (int )>::value ));
+BOOST_STATIC_ASSERT(( has_signature<overload_type, int (char )>::value ));
+BOOST_STATIC_ASSERT(( has_signature<overload_type, int (double )>::value ));
+BOOST_STATIC_ASSERT(( !has_signature<overload_type, int (long )>::value ));
+
+BOOST_STATIC_ASSERT(( have_any_shared_signature<overload_type, bar>::value ));
+BOOST_STATIC_ASSERT(( !have_any_shared_signature<overload_type, foo_ptr>::value ));
+
+
+
+
+typedef boost::function<int(double)> function_type;
+
+
+BOOST_STATIC_ASSERT(( extent<function_type>::value == 1 ));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ signature<function_type>::type,
+ int (double )
+ >::value
+));
+
+BOOST_STATIC_ASSERT((
+ is_same<
+ function<function_type>::type,
+ boost::function<int (double )>
+ >::value
+));
+
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<function_type, int (double )>::value == 0 ));
+BOOST_STATIC_ASSERT(( boost::overloads::index_of_signature<function_type, int (char )>::value == -1 ));
+
+BOOST_STATIC_ASSERT(( has_signature<function_type, int (double )>::value ));
+BOOST_STATIC_ASSERT(( !has_signature<function_type, int (char )>::value ));
+
+BOOST_STATIC_ASSERT(( have_any_shared_signature<function_type, bar>::value ));
+BOOST_STATIC_ASSERT(( !have_any_shared_signature<function_type, foo_ptr>::value ));
+
+} // end namespace metafunction_test_ns
+
+#endif /* _TEST_METAFUNCTIONS_HPP_ */

Added: sandbox/overload/trunk/libs/overload/tests/test/result.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/result.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,106 @@
+
+#ifndef _TEST_RESULT_HPP_
+#define _TEST_RESULT_HPP_
+
+
+#include <boost/utility/result_of.hpp>
+#include "detail/change_result_type.hpp"
+
+namespace result_test_ns {
+
+typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t, sig5_t>
+ overload_type;
+
+//////////////////////////////////////////////////////////////////////////////
+// test change_result_type
+
+BOOST_STATIC_ASSERT(( is_same<
+ overload_type (std::string , std::string , std::string ),
+ ovdtl::change_result_type<overload_type, sig0_t>::type
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ overload_type (bar1*, char ),
+ ovdtl::change_result_type<overload_type, sig1_t>::type
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ overload_type (const bar2*, int, char ),
+ ovdtl::change_result_type<overload_type, sig2_t>::type
+ >::value ));
+
+//////////////////////////////////////////////////////////////////////////////
+// test result
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::result< ovdtl::change_result_type<overload_type, sig0_t>::type >::type,
+ int
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::result< ovdtl::change_result_type<overload_type, sig1_t>::type >::type,
+ int
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::result< ovdtl::change_result_type<overload_type, sig2_t>::type >::type,
+ double
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::result< ovdtl::change_result_type<overload_type, sig3_t>::type >::type,
+ char
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::result< ovdtl::change_result_type<overload_type, sig4_t>::type >::type,
+ int
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ ovdtl::result< ovdtl::change_result_type<overload_type, sig5_t>::type >::type,
+ double
+ >::value ));
+
+//////////////////////////////////////////////////////////////////////////////
+// test boost::result_of
+
+BOOST_STATIC_ASSERT(( is_same<
+ boost::result_of< ovdtl::change_result_type<overload_type, sig0_t>::type >::type,
+ int
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ boost::result_of< ovdtl::change_result_type<overload_type, sig1_t>::type >::type,
+ int
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ boost::result_of< ovdtl::change_result_type<overload_type, sig2_t>::type >::type,
+ double
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ boost::result_of< ovdtl::change_result_type<overload_type, sig3_t>::type >::type,
+ char
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ boost::result_of< ovdtl::change_result_type<overload_type, sig4_t>::type >::type,
+ int
+ >::value ));
+
+BOOST_STATIC_ASSERT(( is_same<
+ boost::result_of< ovdtl::change_result_type<overload_type, sig5_t>::type >::type,
+ double
+ >::value ));
+
+//BOOST_STATIC_ASSERT(( is_same<
+// boost::result_of< ovdtl::change_result_type<overload_type, int(int* )>::type >::type,
+// int
+// >::value ));
+
+} // namespace result_test_ns
+
+
+#endif /* _TEST_RESULT_HPP_ */

Added: sandbox/overload/trunk/libs/overload/tests/test/set_target.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/set_target.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,63 @@
+
+#ifndef _TEST_SET_TARGET_HPP_
+#define _TEST_SET_TARGET_HPP_
+
+
+void set_target_test()
+{
+ boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t, sig5_t, sig6_1_t, sig6_2_t, sig7_1_t, sig7_2_t> f;
+
+ f0_t f0 = &foo0; // function pointer
+ f1_t f1 = &bar1::foo1; // member function pointer
+ f2_t f2 = &bar2::foo2; // member function pointer (with const)
+ f3_t f3 = &foo3; // boost::function
+ f4_t f4; // function object
+ f5_t f5; // function object (with const)
+
+ f.set( f0 );
+ f.set( f1 );
+ f.set( f2 );
+ f.set( f3 );
+ f.set( f4 );
+ f.set( f5 );
+
+ f.clear_all();
+
+ f.set_for_each_shared_signature( f0 );
+ f.set_for_each_shared_signature( f1 );
+ f.set_for_each_shared_signature( f2 );
+ f.set_for_each_shared_signature( f3 );
+ f.set_for_each_shared_signature( f4 );
+ f.set_for_each_shared_signature( f5 );
+
+
+ // MSVC 7.1 doesn't succeed in deducing the signature of a multi-signature
+ // function object
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ f6_t f6; // overloaded function object
+ f7_t f7; // template function object
+
+ //f.set( f6 ); // more than one signature supported
+ //f.set( f7 ); // more than one signature supported
+
+ f.set_for_each_shared_signature( f6 );
+ f.set_for_each_shared_signature( f7 );
+#endif
+
+
+ //f8_t f8 = &foo8; // function pointer
+ //f9_1_t f9_1 = &bar9::foo9_1; // member function pointer
+
+ //f.set( f8 ); // not supported signature
+ //f.set( f9_1 ); // not supported signature
+
+ //f.set_for_each_shared_signature( f8 );
+ //f.set_for_each_shared_signature( f9_1 );
+
+}
+
+
+
+
+#endif // _TEST_SET_TARGET_HPP_
+

Modified: sandbox/overload/trunk/libs/overload/tests/test/signature_deduction.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/signature_deduction.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/signature_deduction.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -3,10 +3,10 @@
 #define _TEST_SIGNATURE_DEDUCTION_HPP_
 
 
-void test05()
+void signature_deduction_test()
 {
     typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t,
- sig5_t, sig6_t, sig7_t, sig8_t, sig9_t>
+ sig5_t, sig6_1_t, sig6_2_t, sig7_1_t, sig7_2_t>
             overload_type;
 
     f0_t f0 = &foo0; // function pointer
@@ -21,19 +21,19 @@
     overload_type f(f4, f2);
     f.set(f0, f5, f1, f3);
 
- f( "Hello", ", ", "world !" );
-
- int i = f(&b1, 'x');
- double d1 = f(&b2, 123, 'x');
- char c = f("hello");
- int j = f('x');
- double d2 = f(123, 'x');
-
- BOOST_ASSERT(i == 123);
- BOOST_ASSERT(d1 > 123.455 && d1 < 123.457);
- BOOST_ASSERT(c == 'x');
- BOOST_ASSERT(j == 123);
- BOOST_ASSERT(d2 > 123.455 && d2 < 123.457);
+ int out0 = f( "Hello", ", ", "world !" );
+ int out1 = f(&b1, 'x');
+ double out2 = f(&b2, 123, 'x');
+ char out3 = f("hello");
+ int out4 = f('x');
+ double out5 = f(123, 'x');
+
+ BOOST_ASSERT(out0 == 12);
+ BOOST_ASSERT(out1 == 123);
+ BOOST_ASSERT(out2 > 233.999 && out2 < 234.001);
+ BOOST_ASSERT(out3 == 'Y');
+ BOOST_ASSERT(out4 == 456);
+ BOOST_ASSERT(out5 > 566.999 && out5 < 567.001);
 
 
     //////////////////////////////////////////////////////////////////////////
@@ -44,25 +44,27 @@
 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
  
     f6_t f6; // overloaded function object
- f7_t f7; // polymorfic function object
+ f7_t f7; // template function object
 
- f.set(f7, f6);
+ f.set_for_each_shared_signature(f6);
+ f.set_for_each_shared_signature(f7);
 
- double d3 = f(2.5f);
- double d4 = f(3.0f, 4.0f);
- int k = f(1);
- double d5 = f(2.5);
-
- BOOST_ASSERT(d3 == 3.5);
- BOOST_ASSERT(d4 == 7.0);
- BOOST_ASSERT(k == 2);
- BOOST_ASSERT(d5 == 3.5);
+ double out61 = f(2.5f);
+ double out62 = f(3.0f, 4.0f);
+ int out71 = f(1);
+ double out72 = f(2.5);
+
+ BOOST_ASSERT(out61 > 6780.999 && out61 < 6781.001);
+ BOOST_ASSERT(out62 > 6781.999 && out62 < 6782.001);
+ BOOST_ASSERT(out71 == (789 + sizeof(int)));
+ BOOST_ASSERT(out72 > (788.999 + sizeof(double)) &&
+ out72 < (789.001 + sizeof(double)));
 
 
 
     boost::overload<int (int, int), int (int, std::string )> g;
     f14_t f14;
- g.set(f14);
+ g.set_for_each_shared_signature(f14);
     BOOST_ASSERT( g(1,1) == sizeof(int) );
     BOOST_ASSERT( g(1, std::string("hi")) == sizeof(std::string) );
 

Modified: sandbox/overload/trunk/libs/overload/tests/test/signature_with_ptr_ref.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/signature_with_ptr_ref.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/signature_with_ptr_ref.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -3,17 +3,17 @@
 #define _TEST_SIGNATURE_WITH_PTR_AND_REF_HPP_
 
 
-void test08()
+void signature_with_ptr_and_ref_test()
 {
- boost::overload<sig10_t, sig11_t, sig12_t, sig13_t> f;
+ boost::overload<sig8_t, sig9_1_t, sig9_2_t, sig10_t> f;
 
     bar9 b9;
- bar11 b11;
+ bar10 b10;
 
     f.set(&foo8);
- f.set(&bar9::foo9);
- f.set(&bar9::foo10);
- f.set(&bar11::foo11);
+ f.set(&bar9::foo9_1);
+ f.set(&bar9::foo9_2);
+ f.set(&bar10::foo10);
 
     double d = 5;
     double* p = &d;
@@ -21,20 +21,33 @@
     BOOST_ASSERT( f(d) == 8 );
     BOOST_ASSERT( f(&b9, &p) == 9 );
     BOOST_ASSERT( f(&b9 , p) == 10 );
- BOOST_ASSERT( f(&b11, &p) == 11 );
+ BOOST_ASSERT( f(&b10, &p) == 11 );
 
     f.clear_all();
     BOOST_ASSERT( f.empty_all() );
 
- f.set<sig10_t>(&foo8);
- f.set<sig11_t>(&bar9::foo9);
- f.set<sig12_t>(&bar9::foo10);
- f.set<sig13_t>(&bar11::foo11);
+ f.set<sig8_t>(&foo8);
+ f.set<sig9_1_t>(&bar9::foo9_1);
+ f.set<sig9_2_t>(&bar9::foo9_2);
+ f.set<sig10_t>(&bar10::foo10);
 
     BOOST_ASSERT( f(d) == 8 );
     BOOST_ASSERT( f(&b9, &p) == 9 );
     BOOST_ASSERT( f(&b9 , p) == 10 );
- BOOST_ASSERT( f(&b11, &p) == 11 );
+ BOOST_ASSERT( f(&b10, &p) == 11 );
+
+ f.clear_all();
+ BOOST_ASSERT( f.empty_all() );
+
+ f.set<0>(&foo8);
+ f.set<1>(&bar9::foo9_1);
+ f.set<2>(&bar9::foo9_2);
+ f.set<3>(&bar10::foo10);
+
+ BOOST_ASSERT( f(d) == 8 );
+ BOOST_ASSERT( f(&b9, &p) == 9 );
+ BOOST_ASSERT( f(&b9 , p) == 10 );
+ BOOST_ASSERT( f(&b10, &p) == 11 );
 
 }
 

Added: sandbox/overload/trunk/libs/overload/tests/test/test_target.hpp
==============================================================================
--- (empty file)
+++ sandbox/overload/trunk/libs/overload/tests/test/test_target.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -0,0 +1,26 @@
+
+#ifndef _TEST_TEST_TARGET_HPP_
+#define _TEST_TEST_TARGET_HPP_
+
+
+void test_target_test()
+{
+ boost::overload<sig0_t, sig1_t, sig2_t> f;
+ BOOST_ASSERT( f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+
+ f.set(&foo0);
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+
+ f.set(&bar1::foo1);
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_any() );
+
+ f.set(&bar2::foo2);
+ BOOST_ASSERT( !f.empty_all() );
+ BOOST_ASSERT( f.empty_none() );
+}
+
+
+#endif /* _TEST_TEST_TARGET_HPP_ */

Modified: sandbox/overload/trunk/libs/overload/tests/test/trait_by_functor.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/trait_by_functor.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/trait_by_functor.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -6,17 +6,31 @@
 namespace test03 {
 
 typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t,
- sig5_t, sig6_t, sig7_t, sig8_t, sig9_t>
+ sig5_t, sig6_1_t, sig6_2_t, sig7_1_t, sig7_2_t>
         overload_type;
 
 BOOST_STATIC_ASSERT(( ovdtl::functor_has_signature<f4_t, sig4_t>::value ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f0_t, overload_type>::value == 1 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f1_t, overload_type>::value == 1 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f3_t, overload_type>::value == 1 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f4_t, overload_type>::value == 1 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f8_t, overload_type>::value == 0 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f10_t, overload_type>::value == 0 ));
+
+// MSVC 7.1 doesn't succeed in managing the signature of a multi-signature
+// function object
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f6_t, overload_type>::value == 2 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f7_t, overload_type>::value == 2 ));
+BOOST_STATIC_ASSERT(( ovdtl::number_of_shared_signatures<f14_t, overload_type>::value == 1 ));
+#endif
 
 }
 
 
 namespace test04 {
 
-typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t, sig5_t, sig6_t, sig7_t>
+typedef boost::overload<sig0_t, sig1_t, sig2_t, sig3_t, sig4_t, sig5_t, sig6_1_t, sig6_2_t>
         overload_type;
 
 BOOST_STATIC_ASSERT((
@@ -35,8 +49,9 @@
>::value
 ));
 BOOST_STATIC_ASSERT(( ovdtl::index_by_functor<f2_t, overload_type>::value == 2 ));
-BOOST_STATIC_ASSERT(( ovdtl::has_functor_signature<f4_t, overload_type>::value ));
-BOOST_STATIC_ASSERT(( !ovdtl::has_functor_signature<f7_t, overload_type>::value ));
+BOOST_STATIC_ASSERT(( ovdtl::have_any_shared_signature<f3_t, overload_type>::value ));
+BOOST_STATIC_ASSERT(( ovdtl::have_any_shared_signature<f4_t, overload_type>::value ));
+BOOST_STATIC_ASSERT(( !ovdtl::have_any_shared_signature<f7_t, overload_type>::value ));
 
 }
 

Modified: sandbox/overload/trunk/libs/overload/tests/test/trait_by_index.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/trait_by_index.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/trait_by_index.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -19,7 +19,7 @@
 #endif
 BOOST_STATIC_ASSERT(( is_same<ovdtl::signature<2,overload_type>::type, sig2_t>::value ));
 BOOST_STATIC_ASSERT((
- is_same<ovdtl::function<5, overload_type>::type,
+ is_same<ovdtl::function<5, overload_type>::type,
             boost::function<sig5_t>
>::value
 ));

Modified: sandbox/overload/trunk/libs/overload/tests/test/trait_by_signature.hpp
==============================================================================
--- sandbox/overload/trunk/libs/overload/tests/test/trait_by_signature.hpp (original)
+++ sandbox/overload/trunk/libs/overload/tests/test/trait_by_signature.hpp 2012-03-19 15:48:13 EDT (Mon, 19 Mar 2012)
@@ -16,9 +16,9 @@
>::value
 ));
 #endif
-BOOST_STATIC_ASSERT(( ovdtl::index<sig2_t, overload_type>::value == 2 ));
+BOOST_STATIC_ASSERT(( ovdtl::index_of_signature<sig2_t, overload_type>::value == 2 ));
 BOOST_STATIC_ASSERT(( ovdtl::has_signature<sig5_t, overload_type>::value ));
-BOOST_STATIC_ASSERT(( !ovdtl::has_signature<sig6_t, overload_type>::value ));
+BOOST_STATIC_ASSERT(( !ovdtl::has_signature<sig6_1_t, overload_type>::value ));
 
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk