Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85767 - in trunk/boost/asio: . detail
From: chris_at_[hidden]
Date: 2013-09-17 18:42:50


Author: chris_kohlhoff
Date: 2013-09-17 18:42:50 EDT (Tue, 17 Sep 2013)
New Revision: 85767
URL: http://svn.boost.org/trac/boost/changeset/85767

Log:
Add use_future support for Microsoft Visual C++.

Text files modified:
   trunk/boost/asio/detail/config.hpp | 25 +++++++++++++++++++++++++
   trunk/boost/asio/use_future.hpp | 6 +++++-
   2 files changed, 30 insertions(+), 1 deletions(-)

Modified: trunk/boost/asio/detail/config.hpp
==============================================================================
--- trunk/boost/asio/detail/config.hpp Tue Sep 17 18:38:04 2013 (r85766)
+++ trunk/boost/asio/detail/config.hpp 2013-09-17 18:42:50 EDT (Tue, 17 Sep 2013) (r85767)
@@ -157,6 +157,31 @@
 # endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
 #endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
 
+// Support constexpr on compilers known to allow it.
+#if !defined(BOOST_ASIO_HAS_CONSTEXPR)
+# if !defined(BOOST_ASIO_DISABLE_CONSTEXPR)
+# if defined(__clang__)
+# if __has_feature(__cxx_constexpr__)
+# define BOOST_ASIO_HAS_CONSTEXPR 1
+# endif // __has_feature(__cxx_constexr__)
+# endif // defined(__clang__)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_CONSTEXPR 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# endif // !defined(BOOST_ASIO_DISABLE_CONSTEXPR)
+#endif // !defined(BOOST_ASIO_HAS_CONSTEXPR)
+#if !defined(BOOST_ASIO_CONSTEXPR)
+# if defined(BOOST_ASIO_HAS_CONSTEXPR)
+# define BOOST_ASIO_CONSTEXPR constexpr
+# else // defined(BOOST_ASIO_HAS_CONSTEXPR)
+# define BOOST_ASIO_CONSTEXPR
+# endif // defined(BOOST_ASIO_HAS_CONSTEXPR)
+#endif // !defined(BOOST_ASIO_CONSTEXPR)
+
 // Standard library support for system errors.
 # if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
 # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)

Modified: trunk/boost/asio/use_future.hpp
==============================================================================
--- trunk/boost/asio/use_future.hpp Tue Sep 17 18:38:04 2013 (r85766)
+++ trunk/boost/asio/use_future.hpp 2013-09-17 18:42:50 EDT (Tue, 17 Sep 2013) (r85767)
@@ -47,7 +47,7 @@
   typedef Allocator allocator_type;
 
   /// Construct using default-constructed allocator.
- constexpr use_future_t()
+ BOOST_ASIO_CONSTEXPR use_future_t()
   {
   }
 
@@ -78,7 +78,11 @@
 /**
  * See the documentation for boost::asio::use_future_t for a usage example.
  */
+#if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
 constexpr use_future_t<> use_future;
+#elif defined(BOOST_ASIO_MSVC)
+__declspec(selectany) use_future_t<> use_future;
+#endif
 
 } // namespace asio
 } // namespace boost


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