Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Variadic Templates before C++11

Tags:

c++

c++11

boost

How did Boost implement Tuple before C++11 and Variadic Templates?

In other words:
Is it possible to implement a Variadic Templates class or function by not using built-in Variadic Templates feature in C++11?

like image 563
MBZ Avatar asked Jan 02 '13 02:01

MBZ


1 Answers

Boost had a limit for the size of the tuple. As in most real-world scenarios you don't need more than 10 elements, you won't mind this limitation. As a library maintainer, I guess, the world became much simpler with variadic templates. No more macro hacks...

Here is an insightful discussion about the size limit of Boost tuple and its implementation: boost tuple: increasing maximum number of elements

To answer your second question: No, it is not possible. At least not for an unlimited number of elements.

like image 158
Philipp Claßen Avatar answered Nov 05 '22 12:11

Philipp Claßen