1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #ifndef BOOST_SIGNALS2_SIGNALS_COMMON_HPP
- #define BOOST_SIGNALS2_SIGNALS_COMMON_HPP
- #include <boost/core/ref.hpp>
- #include <boost/mpl/bool.hpp>
- #include <boost/mpl/if.hpp>
- #include <boost/signals2/signal_base.hpp>
- #include <boost/type_traits/is_base_of.hpp>
- namespace boost {
- namespace signals2 {
- namespace detail {
-
- template<typename T>
- class is_signal: public mpl::bool_<is_base_of<signal_base, T>::value>
- {};
-
-
- struct signal_tag {};
- struct reference_tag {};
- struct value_tag {};
-
-
- template<typename S>
- class get_slot_tag {
- typedef typename mpl::if_<is_signal<S>,
- signal_tag, value_tag>::type signal_or_value;
- public:
- typedef typename mpl::if_<is_reference_wrapper<S>,
- reference_tag,
- signal_or_value>::type type;
- };
-
- template<typename F>
- typename F::weak_signal_type
- get_invocable_slot(const F &signal, signal_tag)
- { return typename F::weak_signal_type(signal); }
- template<typename F>
- const F&
- get_invocable_slot(const F& f, reference_tag)
- { return f; }
- template<typename F>
- const F&
- get_invocable_slot(const F& f, value_tag)
- { return f; }
-
-
- template<typename F>
- typename get_slot_tag<F>::type
- tag_type(const F&)
- {
- typedef typename get_slot_tag<F>::type
- the_tag_type;
- the_tag_type tag = the_tag_type();
- return tag;
- }
- }
- }
- }
- #endif
|