boost代码分析:IF Selector

namespace intimate {
    struct SelectThen
    {
        template<typename Then, typename Else>
        struct Result
        {
            typedef Then type;
        };
    };

    struct SelectElse
    {
        template<typename Then, typename Else>
        struct Result
        {
            typedef Else type;
        };
    };

    template<bool Condition>
    struct Selector
    {
        typedef SelectThen type;
    };

    template<>
    struct Selector<false>
    {
        typedef SelectElse type;
    };
}

template<bool Condition, typename Then, typename Else>
struct IF
{
    typedef typename intimate::Selector<Condition>::type select;
    typedef typename select::template Result<Then,Else>::type type;
};



template<typename T>
struct is_ref
{
    static const bool value = false;
};

template<typename T>
struct is_ref<reference_wrapper<T> >
{
    static const bool value = true;
};

struct signal_tag {};
struct reference_tag {};
struct value_tag {};



template<typename S>
class get_slot_tag {
    typedef typename IF<(is_signal<S>::value),
        signal_tag,
        value_tag>::type signal_or_value;

public:
    typedef typename IF<(is_ref<S>::value),
        reference_tag,
        signal_or_value>::type type;
};