From: KizzaGMbidde on
I do not know if anyone suggested this, but I think this would be a
good special case for a C++ while loop;

template<class... Arg>
inline ReturnVal
fun(Arg&&... arg){

while(arg...){//or for(;arg;)//

//code.................//

//access individual elements from
parameter pack//
auto var = arg; //or auto var =
arg...//?? Or other_fun(arg);//


//code.................//

}//end variadic while//

}//end fun//

Alas, I also know the committee is not to ecstatic about introducing
features that only support one part of the language, but features that
are generally usable for software engineering.
What is your take on the above?

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Andy Venikov on
KizzaGMbidde wrote:
> I do not know if anyone suggested this, but I think this would be a
> good special case for a C++ while loop;
>
> template<class... Arg>
> inline ReturnVal
> fun(Arg&&... arg){
>
> while(arg...){//or for(;arg;)//
>
> //code.................//
>
> //access individual elements from
> parameter pack//
> auto var = arg; //or auto var =
> arg...//?? Or other_fun(arg);//
>
>
> //code.................//
>
> }//end variadic while//
>
> }//end fun//
>
> Alas, I also know the committee is not to ecstatic about introducing
> features that only support one part of the language, but features that
> are generally usable for software engineering.
> What is your take on the above?
>

Parameter packs have an intrinsic recursive quality in them, not
iterative. So the best way to iterate through them is by compile-time
recursion. It can already be done through regular means without adding
new "for" or "while" structures:

inline void fun()
{
return;
}

template <class FristArg, class ... Args>
inline void
fun (FirstArg && arg1, Args && ... args)
{
//Do manipulation on arg1
fun(std::forward<Args>(args)...);
}



Andy.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]