File indexing completed on 2025-01-18 09:51:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_SIGNALS2_SIGNALS_COMMON_HPP
0012 #define BOOST_SIGNALS2_SIGNALS_COMMON_HPP
0013
0014 #include <boost/core/ref.hpp>
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/mpl/if.hpp>
0017 #include <boost/signals2/signal_base.hpp>
0018 #include <boost/type_traits/is_base_of.hpp>
0019
0020 namespace boost {
0021 namespace signals2 {
0022 namespace detail {
0023
0024 template<typename T>
0025 class is_signal: public mpl::bool_<is_base_of<signal_base, T>::value>
0026 {};
0027
0028
0029
0030 struct signal_tag {};
0031 struct reference_tag {};
0032 struct value_tag {};
0033
0034
0035
0036 template<typename S>
0037 class get_slot_tag {
0038 typedef typename mpl::if_<is_signal<S>,
0039 signal_tag, value_tag>::type signal_or_value;
0040 public:
0041 typedef typename mpl::if_<is_reference_wrapper<S>,
0042 reference_tag,
0043 signal_or_value>::type type;
0044 };
0045
0046
0047 template<typename F>
0048 typename F::weak_signal_type
0049 get_invocable_slot(const F &signal, signal_tag)
0050 { return typename F::weak_signal_type(signal); }
0051
0052 template<typename F>
0053 const F&
0054 get_invocable_slot(const F& f, reference_tag)
0055 { return f; }
0056
0057 template<typename F>
0058 const F&
0059 get_invocable_slot(const F& f, value_tag)
0060 { return f; }
0061
0062
0063
0064 template<typename F>
0065 typename get_slot_tag<F>::type
0066 tag_type(const F&)
0067 {
0068 typedef typename get_slot_tag<F>::type
0069 the_tag_type;
0070 the_tag_type tag = the_tag_type();
0071 return tag;
0072 }
0073 }
0074 }
0075 }
0076
0077 #endif