how calculate the number of arguments in a function?

i'm trying building my how Write() function:

template <typename T>
....
Write(T Argument1[,T ArgumentX])

how can i calculate the numeber of Arguments added?
(in C we used an argument for tells how many we putted in a function, but not in these case)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>

template < typename T > void write( T&& arg )
{
    std::cout << "#args " << 1 << " => " ;
    std::cout << "write: " << arg << '\n' ;
}

template < typename FIRST, typename... REST > void write( FIRST&& first, REST&&... rest )
{
    std::cout << "#args " << 1 + sizeof...(rest) << "  =>  " ;
    write(first) ;
    write(rest...) ;
}

int main()
{
    int i = 3 ;
    double d = 7.89 ;
    write( i, &i, d, -120000000000012LL, "hello world" ) ;
}

http://ideone.com/w5Cqhm
thanks for all
Topic archived. No new replies allowed.