What is the meaning of empty “” in template usage?

It just means the template should use the default parameter(s). For example:

template <int N = 10>
class X { };

X<> x;  // this is an X<10> 

Clearly, it’s only possible when all the template parameters have defaults (or for variadic templates that have no mandatory parameters – see below)….

For boost::tokenizer specifically, the template’s:

template <
    class TokenizerFunc = char_delimiters_separator<char>, 
    class Iterator = std::string::const_iterator,
    class Type = std::string
>
class tokenizer;

It’s not relevant to the “meaning of tokenizer<> tok that the body of your question focuses on, but to address the more general question title “What is the meaning of empty “<>” in template usage?”

As Shafik first mentioned, the my_template<> form can also be used with variadic templates such as std::tuple to specify an empty parameter pack:

// namespace std { template <class ...Args> class tuple; }
std::tuple<> t;  // this tuple can't store anything :-.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)