1

Can't google this out so just looking for a quick answer. What this syntax means and is it standard C++?

template <class ...Options>
class list_base_hook;

The code is from boost libraries. http://www.boost.org/doc/libs/1_52_0/doc/html/intrusive/usage.html

John Dibling
  • 99,718
  • 31
  • 186
  • 324
nightlytrails
  • 2,448
  • 3
  • 22
  • 33
  • 3
    The search keyword here is "variadic templates". It means you can pass many arguments. It is a C++11 feature, but Boost did some tricks to make that class work before C++03. – R. Martinho Fernandes Dec 17 '12 at 13:48
  • 1
    See [Variadic templates](http://stackoverflow.com/questions/276188/variadic-templates). – Bo Persson Dec 17 '12 at 13:49

2 Answers2

10

This is a variadic template which is part of the new C++11 standard.

ltjax
  • 15,837
  • 3
  • 39
  • 62
2

In C++11 it's a variadic template parameter.

Boost uses that syntax for "psuedo-variadic" templates from C++03 too - meaning it is a bunch typenames with defaults. Not exactly the same as C++11's variadics. Like this:

template <class opt1 = dummy, class op2 = dummy, class op3 = dummy, /* and so on up to a large N */>
class list_base_hook;
Pubby
  • 51,882
  • 13
  • 139
  • 180