]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/signals2/include/boost/signals2/preprocessed_slot.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / signals2 / include / boost / signals2 / preprocessed_slot.hpp
1 // Boost.Signals2 library
2
3 // Copyright Frank Mori Hess 2007-2009.
4 // Copyright Timmo Stange 2007.
5 // Copyright Douglas Gregor 2001-2004. Use, modification and
6 // distribution is subject to the Boost Software License, Version
7 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 // For more information, see http://www.boost.org
11
12 #ifndef BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP
13 #define BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP
14
15 #include <boost/preprocessor/repetition.hpp>
16 #include <boost/signals2/detail/preprocessed_arg_type.hpp>
17 #include <boost/type_traits/function_traits.hpp>
18
19 #ifndef BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS
20 #define BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS 10
21 #endif
22
23
24 // template<typename Func, typename BindArgT0, typename BindArgT1, ..., typename BindArgTN-1> slotN(...
25 #define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR(z, n, data) \
26 template<typename Func, BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(n, BindArg)> \
27 BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)( \
28 const Func &func, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(n, const BindArg)) \
29 { \
30 init_slot_function(boost::bind(func, BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(n))); \
31 }
32 #define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS \
33 BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR, ~)
34
35
36 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_INC(BOOST_SIGNALS2_MAX_ARGS))
37 #define BOOST_PP_FILENAME_1 <boost/signals2/detail/slot_template.hpp>
38 #include BOOST_PP_ITERATE()
39
40 #undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR
41 #undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS
42
43 namespace boost
44 {
45 namespace signals2
46 {
47 template<typename Signature,
48 typename SlotFunction = boost::function<Signature> >
49 class slot: public detail::slotN<function_traits<Signature>::arity,
50 Signature, SlotFunction>::type
51 {
52 private:
53 typedef typename detail::slotN<boost::function_traits<Signature>::arity,
54 Signature, SlotFunction>::type base_type;
55 public:
56 template<typename F>
57 slot(const F& f): base_type(f)
58 {}
59 // bind syntactic sugar
60 // template<typename F, typename BindArgT0, typename BindArgT1, ..., typename BindArgTn-1> slot(...
61 #define BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
62 template<typename Func, BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(n, BindArg)> \
63 slot(const Func &func, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(n, const BindArg)): \
64 base_type(func, BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(n)) \
65 {}
66 BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR, ~)
67 #undef BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR
68 };
69 } // namespace signals2
70 }
71
72 #endif // BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP