C++ 模板编程之 包扩展?

template <typename T>
T work(T t){
    cout<<t<<endl;
    return t;
}

template <typename T> 
void print(const T &t){ 
    cout<<t<<endl;
}

template <typename T, typename... Args>
void  print(const T &t, const Args&... rest){    
    cout<<t<<endl;
    print(  work(rest)... );

        //这里,为什么调用上面的 print(  work(rest)... );可以实现对rest参数包的打印
        //而直接调用下面的work(rest)... 则会编译错误呢?    
    //work(rest)... ;  // 出错
}
int main(){
    print(1,0.1, 'c',string("str")) ;   
}  


template <typename... Args>
void  print_all(const Args&... rest){    
    //有没有办法通过类似下面的语句,直接实现对参数包所有参数的打印呢?
    //(cout<<rest)... ;
}

因为你的work函数里的参数不是const的,无法转换