Ticket #8115: signals2-cxx11-smart-ptr.patch

File signals2-cxx11-smart-ptr.patch, 1.9 KB (added by Eric Niebler, 10 years ago)

the BOOST_NO_CXX11_SMART_PTR config macro exists now, so use it

  • boost/signals2/detail/foreign_ptr.hpp

     
    1818#include <boost/smart_ptr/bad_weak_ptr.hpp>
    1919#include <boost/utility/swap.hpp>
    2020
    21 //FIXME: this is a hack to deal with the fact BOOST_NO_CXX_SMART_PTR doesn't
    22 // exist yet in boost.config.  It will fail on a library which implements
    23 // C++11 std::tuple but not std::shared_ptr and std::weak_ptr.
    24 #ifdef BOOST_NO_CXX11_HDR_TUPLE
    25 #define BOOST_SIGNALS2_NO_CXX11_SMART_PTR
    26 #endif
    27 
    28 #ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
     21#ifndef BOOST_NO_CXX11_SMART_PTR
    2922#include <memory>
    3023#endif
    3124
     
    4235    {
    4336      typedef boost::shared_ptr<T> shared_type;
    4437    };
    45 #ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
     38#ifndef BOOST_NO_CXX11_SMART_PTR
    4639    template<typename T> struct weak_ptr_traits<std::weak_ptr<T> >
    4740    {
    4841      typedef std::shared_ptr<T> shared_type;
     
    5649    {
    5750      typedef boost::weak_ptr<T> weak_type;
    5851    };
    59 #ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
     52#ifndef BOOST_NO_CXX11_SMART_PTR
    6053    template<typename T> struct shared_ptr_traits<std::shared_ptr<T> >
    6154    {
    6255      typedef std::weak_ptr<T> weak_type;
  • libs/signals2/test/track_test.cpp

     
    110110  }
    111111  BOOST_CHECK(s1(2) == 0);
    112112
    113 // there isn't a boost config macro that detects the existance of std::shared_ptr or std::weak_ptr,
    114 // so we rely on BOOST_NO_CXX11_VARIADIC_TEMPLATES as a hack
    115 #ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
     113#ifndef BOOST_NO_CXX11_SMART_PTR
    116114  // Test tracking through std::shared_ptr/weak_ptr
    117115  BOOST_CHECK(s1(5) == 0);
    118116  {