|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66186 - sandbox/variadic_templates/sandbox
From: cppljevans_at_[hidden]
Date: 2010-10-25 14:09:50
Author: cppljevans
Date: 2010-10-25 14:09:49 EDT (Mon, 25 Oct 2010)
New Revision: 66186
URL: http://svn.boost.org/trac/boost/changeset/66186
Log:
Hmmm, this compiles:
-*- mode: compilation; default-directory: "~/prog_dev/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/" -*-
Compilation started at Mon Oct 25 13:09:13
make MAIN=varbin o
install -d `dirname /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.o`
/home/evansl/download/gcc/4.5.1-release/install/bin/g++ -c -Wall -ftemplate-depth-300 -Os -std=gnu++0x -DCXX0X_VARIADIC_TEMPLATES -DBOOST_USE_MPL_VARIADIC_TEMPLATES -I/home/evansl/prog_dev/boost-svn/ro/sandbox/rw/variadic_templates -I/home/evansl/prog_dev/boost-svn/ro/sandbox/ro/switch -I/home/evansl/prog_dev/boost-svn/ro/trunk -DTEMPLATE_DEPTH=300 varbin.cpp -MMD -o /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.o
sed -e 's#^varbin.o:#/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.o:#' /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.d> /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.o.dep
#rm /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.d
Compilation finished at Mon Oct 25 13:09:14
Text files modified:
sandbox/variadic_templates/sandbox/varbin.cpp | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
Modified: sandbox/variadic_templates/sandbox/varbin.cpp
==============================================================================
--- sandbox/variadic_templates/sandbox/varbin.cpp (original)
+++ sandbox/variadic_templates/sandbox/varbin.cpp 2010-10-25 14:09:49 EDT (Mon, 25 Oct 2010)
@@ -2,19 +2,21 @@
// see if variadic reduce is possible using variadic templates.
//
//Result:
-// No, apparently b... is not an arg pack.
-//
-int add(int a,int b){return a+b;}
+// // No, apparently b... is not an arg pack.
+// //
+// int add(int a,int b){return a+b;}
-template<typename T>
-T fold(T (*op)(T,T), T z, T a...)
+template<typename T, typename... U>
+T fold(T (*op)(T,T), T z, U... a)
;
+
template<typename T>
T fold(T (*op)(T,T), T z, T a)
{ return op(z,a)
;}
-template<typename T>
-T fold(T (*op)(T,T), T z, T a, T b...)
+
+template<typename T, typename... U>
+T fold(T (*op)(T,T), T z, T a, U... b)
{ return op(z,fold(op,a,b...))
;}
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