##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# sizeof... operator

From cppreference.com
< cpp‎ | language

Queries the number of elements in a parameter pack.

### [edit] Syntax

`sizeof...(` parameter_pack `)` |  | (since C++11)

Returns an object of type std::size_t.

### [edit] Explanation

Returns the number of elements in a parameter pack.

### [edit] Keywords

`sizeof`

### [edit] Example

Run this code

    #include <iostream>

    template<class... Args>
    std::size_t f()
    {
        return sizeof...(Args);
    }

    int main()
    {
        std::cout << f<>() << '\n'
                  << f<int>() << '\n'
                  << f<char, int, double>() << '\n';
    }

Output:

    0
    1
    3

### [edit] See also

- sizeof

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/language/sizeof...&oldid=69620"