|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86629 - trunk/boost/thread/detail
From: vicente.botet_at_[hidden]
Date: 2013-11-11 18:00:37
Author: viboes
Date: 2013-11-11 18:00:37 EST (Mon, 11 Nov 2013)
New Revision: 86629
URL: http://svn.boost.org/trac/boost/changeset/86629
Log:
Thread: Adding pp variadic to asyn_func and fix some typos.
Added:
trunk/boost/thread/detail/variadic_footer.hpp (contents, props changed)
trunk/boost/thread/detail/variadic_header.hpp (contents, props changed)
Text files modified:
trunk/boost/thread/detail/async_func.hpp | 160 ++++++++++++++++++++++++++++-----------
trunk/boost/thread/detail/variadic_footer.hpp | 10 ++
trunk/boost/thread/detail/variadic_header.hpp | 18 ++++
3 files changed, 142 insertions(+), 46 deletions(-)
Modified: trunk/boost/thread/detail/async_func.hpp
==============================================================================
--- trunk/boost/thread/detail/async_func.hpp Mon Nov 11 17:55:47 2013 (r86628)
+++ trunk/boost/thread/detail/async_func.hpp 2013-11-11 18:00:37 EST (Mon, 11 Nov 2013) (r86629)
@@ -32,6 +32,9 @@
#include <boost/thread/csbl/tuple.hpp>
#include <boost/tuple/tuple.hpp>
+#include <boost/thread/detail/variadic_header.hpp>
+
+
namespace boost
{
namespace detail
@@ -74,6 +77,68 @@
};
//BOOST_THREAD_DCL_MOVABLE_BEG(X) async_func<Fp> BOOST_THREAD_DCL_MOVABLE_END
#else
+
+#if 1
+
+#define BOOST_THREAD_RV_REF_ARG(z, n, unused) , BOOST_THREAD_RV_REF(Arg##n) arg##n
+#define BOOST_THREAD_FWD_REF_ARG(z, n, unused) , BOOST_THREAD_FWD_REF(Arg##n) arg##n
+#define BOOST_THREAD_FWD_PARAM(z, n, unused) , boost::forward<Arg##n>(arg##n)
+#define BOOST_THREAD_DCL(z, n, unused) Arg##n v##n;
+#define BOOST_THREAD_MOVE_PARAM(z, n, unused) , v##n(boost::move(arg##n))
+#define BOOST_THREAD_MOVE_RHS_PARAM(z, n, unused) , v##n(boost::move(f.v##n))
+#define BOOST_THREAD_MOVE_DCL(z, n, unused) , boost::move(v##n)
+#define BOOST_THREAD_ARG_DEF(z, n, unused) , class Arg##n = tuples::null_type
+
+ template <class Fp
+ BOOST_PP_REPEAT(BOOST_THREAD_MAX_ARGS_P1, BOOST_THREAD_ARG_DEF, ~)
+ >
+ class async_func;
+
+#define BOOST_THREAD_ASYNC_FUNCT(z, n, unused) \
+ template <class Fp BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Arg) > \
+ class async_func<Fp BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Arg)> \
+ { \
+ Fp fp_; \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_DCL, ~) \
+ public: \
+ BOOST_THREAD_MOVABLE_ONLY(async_func) \
+ typedef typename result_of<Fp(BOOST_PP_ENUM_PARAMS(n, Arg))>::type result_type; \
+ \
+ BOOST_SYMBOL_VISIBLE \
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG, ~) \
+ ) \
+ : fp_(boost::move(f)) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_PARAM, ~) \
+ {} \
+ \
+ BOOST_SYMBOL_VISIBLE \
+ async_func(BOOST_THREAD_FWD_REF(async_func) f) \
+ : fp_(boost::move(f.fp_)) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_RHS_PARAM, ~) \
+ {} \
+ \
+ result_type operator()() { \
+ return invoke(boost::move(fp_) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_DCL, ~) \
+ ); \
+ } \
+ };
+
+ BOOST_PP_REPEAT(BOOST_THREAD_MAX_ARGS, BOOST_THREAD_ASYNC_FUNCT, ~)
+
+ #undef BOOST_THREAD_RV_REF_ARG
+ #undef BOOST_THREAD_FWD_REF_ARG
+ #undef BOOST_THREAD_FWD_PARAM
+ #undef BOOST_THREAD_DCL
+ #undef BOOST_THREAD_MOVE_PARAM
+ #undef BOOST_THREAD_MOVE_RHS_PARAM
+ #undef BOOST_THREAD_MOVE_DCL
+ #undef BOOST_THREAD_ARG_DEF
+ #undef BOOST_THREAD_ASYNC_FUNCT
+
+#else
+
template <class Fp,
class T0 = tuples::null_type, class T1 = tuples::null_type, class T2 = tuples::null_type,
class T3 = tuples::null_type, class T4 = tuples::null_type, class T5 = tuples::null_type,
@@ -131,15 +196,15 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
- , v3_(boost::move(BOOST_THREAD_RV(f).a3))
- , v4_(boost::move(BOOST_THREAD_RV(f).a4))
- , v5_(boost::move(BOOST_THREAD_RV(f).a5))
- , v6_(boost::move(BOOST_THREAD_RV(f).a6))
- , v7_(boost::move(BOOST_THREAD_RV(f).a7))
- , v8_(boost::move(BOOST_THREAD_RV(f).a8))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
+ , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
+ , v7_(boost::move(BOOST_THREAD_RV(f).v7_))
+ , v8_(boost::move(BOOST_THREAD_RV(f).v8_))
{}
result_type operator()()
@@ -198,14 +263,14 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
- , v3_(boost::move(BOOST_THREAD_RV(f).a3))
- , v4_(boost::move(BOOST_THREAD_RV(f).a4))
- , v5_(boost::move(BOOST_THREAD_RV(f).a5))
- , v6_(boost::move(BOOST_THREAD_RV(f).a6))
- , v7_(boost::move(BOOST_THREAD_RV(f).a7))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
+ , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
+ , v7_(boost::move(BOOST_THREAD_RV(f).v7_))
{}
result_type operator()()
@@ -260,13 +325,13 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
- , v3_(boost::move(BOOST_THREAD_RV(f).a3))
- , v4_(boost::move(BOOST_THREAD_RV(f).a4))
- , v5_(boost::move(BOOST_THREAD_RV(f).a5))
- , v6_(boost::move(BOOST_THREAD_RV(f).a6))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
+ , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
{}
result_type operator()()
@@ -317,12 +382,12 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
- , v3_(boost::move(BOOST_THREAD_RV(f).a3))
- , v4_(boost::move(BOOST_THREAD_RV(f).a4))
- , v5_(boost::move(BOOST_THREAD_RV(f).a5))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
{}
result_type operator()()
@@ -369,11 +434,11 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
- , v3_(boost::move(BOOST_THREAD_RV(f).a3))
- , v4_(boost::move(BOOST_THREAD_RV(f).a4))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
{}
result_type operator()()
@@ -416,10 +481,10 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
- , v3_(boost::move(BOOST_THREAD_RV(f).a3))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
{}
result_type operator()()
@@ -458,9 +523,9 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
- , v2_(boost::move(BOOST_THREAD_RV(f).a2))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
{}
result_type operator()()
@@ -495,8 +560,8 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
- , v1_(boost::move(BOOST_THREAD_RV(f).a1))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
{}
result_type operator()()
@@ -527,7 +592,7 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_RV_REF(async_func) f)
: fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).a0))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
{}
result_type operator()()
@@ -551,7 +616,7 @@
BOOST_SYMBOL_VISIBLE
async_func(BOOST_THREAD_FWD_REF(async_func) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp_))
+ : fp_(boost::move(f.fp_))
{}
result_type operator()()
{
@@ -559,8 +624,11 @@
}
};
#endif
+#endif
}
}
+#include <boost/thread/detail/variadic_footer.hpp>
+
#endif // header
Added: trunk/boost/thread/detail/variadic_footer.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/thread/detail/variadic_footer.hpp 2013-11-11 18:00:37 EST (Mon, 11 Nov 2013) (r86629)
@@ -0,0 +1,10 @@
+// Copyright (C) 2013 Vicente J. Botet Escriba
+//
+// 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)
+
+
+#if defined BOOST_NO_CXX11_VARIADIC_TEMPLATES
+
+
+#endif
Added: trunk/boost/thread/detail/variadic_header.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/thread/detail/variadic_header.hpp 2013-11-11 18:00:37 EST (Mon, 11 Nov 2013) (r86629)
@@ -0,0 +1,18 @@
+// Copyright (C) 2013 Vicente J. Botet Escriba
+//
+// 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)
+
+#include <boost/config.hpp>
+
+#if defined BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#ifndef BOOST_THREAD_MAX_ARGS
+#define BOOST_THREAD_MAX_ARGS 9
+#define BOOST_THREAD_MAX_ARGS_P1 10
+#endif
+
+#endif
+
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