Suppose, in c++ i've got a variadic template function F, and i want to convert all the arguments in some individual manner by function conv and pass all the converted arguments as a variadic list to another variadic template function G.
Then i just do the following:

template<typename T>
struct R;

template<typename T>
R<T>::Type conv(T&& val);

template<typename ... Args>
void F(Args&& ... args) {
    G(conv(std::forward<Args>(args))...);
}

Is there any way to do the same kind of thing in D? I couldn't find any unpacking operator or a library function to do so... The problem is that i have to pass converted lits to a C-like variadic function, for example printf, so it would be like:

template<typename T>
struct R;

template<typename T>
R<T>::Type conv(T&& val);

template<typename ... Args>
void MyPrintf(const char * format, Args&& ... args) {
    printf(convFormat(format), conv(std::forward<Args>(args))...);
}

I hope, my point is clear enough.

Reply via email to