Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66184 - sandbox/variadic_templates/sandbox
From: cppljevans_at_[hidden]
Date: 2010-10-25 14:05:31


Author: cppljevans
Date: 2010-10-25 14:05:31 EDT (Mon, 25 Oct 2010)
New Revision: 66184
URL: http://svn.boost.org/trac/boost/changeset/66184

Log:
Fails cuz b not arg pack:

-*- mode: compilation; default-directory: "~/prog_dev/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/" -*-
Compilation started at Mon Oct 25 13:04:44

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
varbin.cpp: In function 'T fold(T (*)(T, T), T, T, T, ...)':
varbin.cpp:18:26: error: expansion pattern 'b' contains no argument packs
make: *** [/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/sandbox/varbin.o] Error 1

Compilation exited abnormally with code 2 at Mon Oct 25 13:04:44

Added:
   sandbox/variadic_templates/sandbox/varbin.cpp (contents, props changed)

Added: sandbox/variadic_templates/sandbox/varbin.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/varbin.cpp 2010-10-25 14:05:31 EDT (Mon, 25 Oct 2010)
@@ -0,0 +1,20 @@
+//Purpose:
+// 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;}
+
+template<typename T>
+T fold(T (*op)(T,T), T z, T 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...)
+{ 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