Ticket #2704: boost_locks.patch

File boost_locks.patch, 1.9 KB (added by jwakely.boost@…, 14 years ago)

patch to use sfinae in is_mutex_type helpers

  • boost/thread/locks.hpp

    namespace boost  
    3636                true_type dummy[2];
    3737            };
    3838           
     39            template<size_t> struct sfinae_type { };
     40
    3941            template<typename U>
    40             static true_type has_member(U*,void (U::*dummy)()=&U::lock);
     42            static true_type has_member(U*,void (U::*dummy)()=&U::lock,sfinae_type<sizeof(&U::unlock)>* = NULL);
    4143            static false_type has_member(void*);
    4244           
    4345            BOOST_STATIC_CONSTANT(bool, value=sizeof(has_member_lock<T>::has_member((T*)NULL))==sizeof(true_type));
    namespace boost  
    5254                true_type dummy[2];
    5355            };
    5456           
     57            template<size_t> struct sfinae_type { };
     58
    5559            template<typename U>
    56             static true_type has_member(U*,void (U::*dummy)()=&U::unlock);
     60            static true_type has_member(U*,void (U::*dummy)()=&U::unlock,sfinae_type<sizeof(&U::unlock)>* = NULL);
    5761            static false_type has_member(void*);
    5862           
    5963            BOOST_STATIC_CONSTANT(bool, value=sizeof(has_member_unlock<T>::has_member((T*)NULL))==sizeof(true_type));
    namespace boost  
    6872                true_type dummy[2];
    6973            };
    7074           
     75            template<size_t> struct sfinae_type { };
     76
    7177            template<typename U>
    72             static true_type has_member(U*,bool (U::*dummy)()=&U::try_lock);
     78            static true_type has_member(U*,sfinae_type<sizeof(&U::try_lock)>* = NULL,sfinae_type<sizeof(&U::try_lock)>* = NULL);
    7379            static false_type has_member(void*);
    7480           
    7581            BOOST_STATIC_CONSTANT(bool, value=sizeof(has_member_try_lock<T>::has_member((T*)NULL))==sizeof(true_type));