|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77289 - trunk/boost/signals2/detail
From: fmhess_at_[hidden]
Date: 2012-03-10 10:10:05
Author: fmhess
Date: 2012-03-10 10:10:05 EST (Sat, 10 Mar 2012)
New Revision: 77289
URL: http://svn.boost.org/trac/boost/changeset/77289
Log:
Try to deal with C++11 (or not) compilers a little better, so we can avoid
standard violation in foreign_ptr.hpp. Refs #6655.
Text files modified:
trunk/boost/signals2/detail/foreign_ptr.hpp | 19 +++++++++++++------
trunk/boost/signals2/detail/variadic_slot_invoker.hpp | 20 +++++++++++++-------
2 files changed, 26 insertions(+), 13 deletions(-)
Modified: trunk/boost/signals2/detail/foreign_ptr.hpp
==============================================================================
--- trunk/boost/signals2/detail/foreign_ptr.hpp (original)
+++ trunk/boost/signals2/detail/foreign_ptr.hpp 2012-03-10 10:10:05 EST (Sat, 10 Mar 2012)
@@ -18,12 +18,15 @@
#include <boost/smart_ptr/bad_weak_ptr.hpp>
#include <boost/utility/swap.hpp>
-#if !defined(BOOST_INTEL_STDCXX0X)
-namespace std
-{
- template<typename T> class shared_ptr;
- template<typename T> class weak_ptr;
-}
+//FIXME: this is a hack to deal with the fact BOOST_NO_CXX_SMART_PTR doesn't
+// exist yet in boost.config. It will fail on a library which implements
+// C++11 std::tuple but not std::shared_ptr and std::weak_ptr.
+#ifdef BOOST_NO_CXX11_HDR_TUPLE
+#define BOOST_SIGNALS2_NO_CXX11_SMART_PTR
+#endif
+
+#ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
+#include <memory>
#endif
namespace boost
@@ -39,10 +42,12 @@
{
typedef boost::shared_ptr<T> shared_type;
};
+#ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
template<typename T> struct weak_ptr_traits<std::weak_ptr<T> >
{
typedef std::shared_ptr<T> shared_type;
};
+#endif
template<typename SharedPtr> struct shared_ptr_traits
{};
@@ -51,10 +56,12 @@
{
typedef boost::weak_ptr<T> weak_type;
};
+#ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
template<typename T> struct shared_ptr_traits<std::shared_ptr<T> >
{
typedef std::weak_ptr<T> weak_type;
};
+#endif
namespace detail
{
Modified: trunk/boost/signals2/detail/variadic_slot_invoker.hpp
==============================================================================
--- trunk/boost/signals2/detail/variadic_slot_invoker.hpp (original)
+++ trunk/boost/signals2/detail/variadic_slot_invoker.hpp 2012-03-10 10:10:05 EST (Sat, 10 Mar 2012)
@@ -16,10 +16,16 @@
#define BOOST_SIGNALS2_DETAIL_VARIADIC_SLOT_INVOKER_HPP
#include <boost/signals2/detail/variadic_arg_type.hpp>
-// if compiler has variadic template support, we assume they have
-// a variadic std::tuple implementation here. We don't use boost::tuple
-// because it does not have variadic template support at present.
+
+// if compiler has std::tuple use it instead of boost::tuple
+// because boost::tuple does not have variadic template support at present.
+#ifdef BOOST_NO_CXX11_HDR_TUPLE
+#include <boost/tuple.hpp>
+#define BOOST_SIGNALS2_TUPLE boost::tuple
+#else
#include <tuple>
+#define BOOST_SIGNALS2_TUPLE std::tuple
+#endif
namespace boost
{
@@ -65,7 +71,7 @@
typedef R result_type;
template<typename Func, typename ... Args>
- R operator()(Func &func, std::tuple<Args...> args) const
+ R operator()(Func &func, BOOST_SIGNALS2_TUPLE<Args...> args) const
{
typedef typename make_unsigned_meta_array<sizeof...(Args)>::type indices_type;
typename Func::result_type *resolver = 0;
@@ -73,12 +79,12 @@
}
private:
template<typename T, typename Func, unsigned ... indices, typename ... Args>
- R m_invoke(T *, Func &func, unsigned_meta_array<indices...>, std::tuple<Args...> args) const
+ R m_invoke(T *, Func &func, unsigned_meta_array<indices...>, BOOST_SIGNALS2_TUPLE<Args...> args) const
{
return func(std::get<indices>(args)...);
}
template<typename Func, unsigned ... indices, typename ... Args>
- R m_invoke(void *, Func &func, unsigned_meta_array<indices...>, std::tuple<Args...> args) const
+ R m_invoke(void *, Func &func, unsigned_meta_array<indices...>, BOOST_SIGNALS2_TUPLE<Args...> args) const
{
func(std::get<indices>(args)...);
return R();
@@ -113,7 +119,7 @@
{
return call_with_tuple_args<result_type>()(connectionBody->slot.slot_function(), _args);
}
- std::tuple<Args& ...> _args;
+ BOOST_SIGNALS2_TUPLE<Args& ...> _args;
};
} // namespace detail
} // namespace signals2
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk