|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85735 - in trunk/boost/asio: . detail
From: chris_at_[hidden]
Date: 2013-09-17 17:31:56
Author: chris_kohlhoff
Date: 2013-09-17 17:31:55 EDT (Tue, 17 Sep 2013)
New Revision: 85735
URL: http://svn.boost.org/trac/boost/changeset/85735
Log:
Remove dependency on Boost.Preprocessor library.
Added:
trunk/boost/asio/detail/variadic_templates.hpp (contents, props changed)
Text files modified:
trunk/boost/asio/basic_socket_iostream.hpp | 33 ++++++-------------
trunk/boost/asio/basic_socket_streambuf.hpp | 22 +++----------
trunk/boost/asio/detail/variadic_templates.hpp | 63 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 80 insertions(+), 38 deletions(-)
Modified: trunk/boost/asio/basic_socket_iostream.hpp
==============================================================================
--- trunk/boost/asio/basic_socket_iostream.hpp Tue Sep 17 17:17:02 2013 (r85734)
+++ trunk/boost/asio/basic_socket_iostream.hpp 2013-09-17 17:31:55 EDT (Tue, 17 Sep 2013) (r85735)
@@ -26,14 +26,7 @@
#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
-# include <boost/preprocessor/arithmetic/inc.hpp>
-# include <boost/preprocessor/repetition/enum_binary_params.hpp>
-# include <boost/preprocessor/repetition/enum_params.hpp>
-# include <boost/preprocessor/repetition/repeat_from_to.hpp>
-
-# if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
-# define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5
-# endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
+# include <boost/asio/detail/variadic_templates.hpp>
// A macro that should expand to:
// template <typename T1, ..., typename Tn>
@@ -48,16 +41,16 @@
// }
// This macro should only persist within this file.
-# define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \
- template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
- explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
+# define BOOST_ASIO_PRIVATE_CTR_DEF(n) \
+ template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
+ explicit basic_socket_iostream(BOOST_ASIO_VARIADIC_PARAMS(n)) \
: std::basic_iostream<char>( \
&this->detail::socket_iostream_base< \
Protocol, StreamSocketService, Time, \
TimeTraits, TimerService>::streambuf_) \
{ \
this->setf(std::ios_base::unitbuf); \
- if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
+ if (rdbuf()->connect(BOOST_ASIO_VARIADIC_ARGS(n)) == 0) \
this->setstate(std::ios_base::failbit); \
} \
/**/
@@ -71,11 +64,11 @@
// }
// This macro should only persist within this file.
-# define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \
- template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
- void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
+# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \
+ template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
+ void connect(BOOST_ASIO_VARIADIC_PARAMS(n)) \
{ \
- if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
+ if (rdbuf()->connect(BOOST_ASIO_VARIADIC_ARGS(n)) == 0) \
this->setstate(std::ios_base::failbit); \
} \
/**/
@@ -175,9 +168,7 @@
this->setstate(std::ios_base::failbit);
}
#else
- BOOST_PP_REPEAT_FROM_TO(
- 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY),
- BOOST_ASIO_PRIVATE_CTR_DEF, _ )
+ BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CTR_DEF)
#endif
#if defined(GENERATING_DOCUMENTATION)
@@ -197,9 +188,7 @@
this->setstate(std::ios_base::failbit);
}
#else
- BOOST_PP_REPEAT_FROM_TO(
- 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY),
- BOOST_ASIO_PRIVATE_CONNECT_DEF, _ )
+ BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CONNECT_DEF)
#endif
/// Close the connection.
Modified: trunk/boost/asio/basic_socket_streambuf.hpp
==============================================================================
--- trunk/boost/asio/basic_socket_streambuf.hpp Tue Sep 17 17:17:02 2013 (r85734)
+++ trunk/boost/asio/basic_socket_streambuf.hpp 2013-09-17 17:31:55 EDT (Tue, 17 Sep 2013) (r85735)
@@ -35,14 +35,7 @@
#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
-# include <boost/preprocessor/arithmetic/inc.hpp>
-# include <boost/preprocessor/repetition/enum_binary_params.hpp>
-# include <boost/preprocessor/repetition/enum_params.hpp>
-# include <boost/preprocessor/repetition/repeat_from_to.hpp>
-
-# if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY)
-# define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5
-# endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY)
+# include <boost/asio/detail/variadic_templates.hpp>
// A macro that should expand to:
// template <typename T1, ..., typename Tn>
@@ -60,17 +53,16 @@
// }
// This macro should only persist within this file.
-# define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \
- template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
+# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \
+ template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
basic_socket_streambuf<Protocol, StreamSocketService, \
- Time, TimeTraits, TimerService>* connect( \
- BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
+ Time, TimeTraits, TimerService>* connect(BOOST_ASIO_VARIADIC_PARAMS(n)) \
{ \
init_buffers(); \
this->basic_socket<Protocol, StreamSocketService>::close(ec_); \
typedef typename Protocol::resolver resolver_type; \
typedef typename resolver_type::query resolver_query; \
- resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \
+ resolver_query query(BOOST_ASIO_VARIADIC_ARGS(n)); \
resolve_and_connect(query); \
return !ec_ ? this : 0; \
} \
@@ -216,9 +208,7 @@
return !ec_ ? this : 0;
}
#else
- BOOST_PP_REPEAT_FROM_TO(
- 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY),
- BOOST_ASIO_PRIVATE_CONNECT_DEF, _ )
+ BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CONNECT_DEF)
#endif
/// Close the connection.
Added: trunk/boost/asio/detail/variadic_templates.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/variadic_templates.hpp 2013-09-17 17:31:55 EDT (Tue, 17 Sep 2013) (r85735)
@@ -0,0 +1,63 @@
+//
+// detail/variadic_templates.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_ASIO_DETAIL_VARIADIC_TEMPLATES_HPP
+#define BOOST_ASIO_DETAIL_VARIADIC_TEMPLATES_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+
+# define BOOST_ASIO_VARIADIC_TPARAMS(n) BOOST_ASIO_VARIADIC_TPARAMS_##n
+
+# define BOOST_ASIO_VARIADIC_TPARAMS_1 \
+ typename T1
+# define BOOST_ASIO_VARIADIC_TPARAMS_2 \
+ typename T1, typename T2
+# define BOOST_ASIO_VARIADIC_TPARAMS_3 \
+ typename T1, typename T2, typename T3
+# define BOOST_ASIO_VARIADIC_TPARAMS_4 \
+ typename T1, typename T2, typename T3, typename T4
+# define BOOST_ASIO_VARIADIC_TPARAMS_5 \
+ typename T1, typename T2, typename T3, typename T4, typename T5
+
+# define BOOST_ASIO_VARIADIC_TARGS(n) BOOST_ASIO_VARIADIC_TARGS_##n
+
+# define BOOST_ASIO_VARIADIC_TARGS_1 x1
+# define BOOST_ASIO_VARIADIC_TARGS_2 x1, x2
+# define BOOST_ASIO_VARIADIC_TARGS_3 x1, x2, x3
+# define BOOST_ASIO_VARIADIC_TARGS_4 x1, x2, x3, x4
+# define BOOST_ASIO_VARIADIC_TARGS_5 x1, x2, x3, x4, x5
+
+# define BOOST_ASIO_VARIADIC_PARAMS(n) BOOST_ASIO_VARIADIC_PARAMS_##n
+
+# define BOOST_ASIO_VARIADIC_PARAMS_1 T1 x1
+# define BOOST_ASIO_VARIADIC_PARAMS_2 T1 x1, T2 x2
+# define BOOST_ASIO_VARIADIC_PARAMS_3 T1 x1, T2 x2, T3 x3
+# define BOOST_ASIO_VARIADIC_PARAMS_4 T1 x1, T2 x2, T3 x3, T4 x4
+# define BOOST_ASIO_VARIADIC_PARAMS_5 T1 x1, T2 x2, T3 x3, T4 x4, T5 x5
+
+# define BOOST_ASIO_VARIADIC_ARGS(n) BOOST_ASIO_VARIADIC_ARGS_##n
+
+# define BOOST_ASIO_VARIADIC_ARGS_1 x1
+# define BOOST_ASIO_VARIADIC_ARGS_2 x1, x2
+# define BOOST_ASIO_VARIADIC_ARGS_3 x1, x2, x3
+# define BOOST_ASIO_VARIADIC_ARGS_4 x1, x2, x3, x4
+# define BOOST_ASIO_VARIADIC_ARGS_5 x1, x2, x3, x4, x5
+
+# define BOOST_ASIO_VARIADIC_GENERATE(m) m(1) m(2) m(3) m(4) m(5)
+
+#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+
+#endif // BOOST_ASIO_DETAIL_VARIADIC_TEMPLATES_HPP
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