Ticket #1002: close.hpp.patch

File close.hpp.patch, 1.4 KB (added by chad@…, 15 years ago)

Patch for close_impl<closable_tag>

  • close.hpp

    old new  
    106106        typedef typename category_of<T>::type category;
    107107        const bool in =  is_convertible<category, input>::value &&
    108108                        !is_convertible<category, output>::value;
    109         if (in == ((which & BOOST_IOS::in) != 0))
     109        const bool out =  is_convertible<category, output>::value &&
     110                        !is_convertible<category, bidirectional>::value;
     111        if ((in && ((which & BOOST_IOS::in) != 0)) ||
     112            (out && ((which & BOOST_IOS::out) != 0))) {
    110113            t.close();
     114        }
    111115    }
    112116    template<typename T, typename Sink>
    113117    static void close(T& t, Sink& snk, BOOST_IOS::openmode which)
     
    115119        typedef typename category_of<T>::type category;
    116120        const bool in =  is_convertible<category, input>::value &&
    117121                        !is_convertible<category, output>::value;
    118         if (in == ((which & BOOST_IOS::in) != 0)) {
     122        const bool out =  is_convertible<category, output>::value &&
     123                        !is_convertible<category, bidirectional>::value;
     124        if ((in && ((which & BOOST_IOS::in) != 0)) ||
     125            (out && ((which & BOOST_IOS::out) != 0))) {
    119126            non_blocking_adapter<Sink> nb(snk);
    120127            t.close(nb);
    121128        }