August 31, 2012
On Fri, 31 Aug 2012 16:56:32 +0200, Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> wrote:

> Hello all,
>
> Is it considered legit in any circumstances for popFront to take an input variable (e.g. a random number generator)?  Or is it required always to have no input variables?

No parameters, or at least it should be callable with no parameters.

Might I ask why you'd want this?

-- 
Simen
August 31, 2012
On Friday, August 31, 2012 15:56:32 Joseph Rushton Wakeling wrote:
> Hello all,
> 
> Is it considered legit in any circumstances for popFront to take an input variable (e.g. a random number generator)? Or is it required always to have no input variables?

Don't do it. Technically speaking, as long as it's callable with no arguments, you should be able to do it. isInputRange just checks that it's callable with no arguments:

template isInputRange(R)
{
 enum bool isInputRange = is(typeof(
 (inout int _dummy=0)
 {
 R r = void; // can define a range object
 if (r.empty) {} // can test for empty
 r.popFront(); // can invoke popFront()
 auto h = r.front; // can get the front of the range
 }));
}

but no range-based anything is going to call popFront with any arguments, and it goes against how popFront works. If you want a function which takes an argument and pops of the front as well, then create a new one. Don't use popFront for that. I have no idea why you'd ever _want_ to do that though. You have a highly abnormal use case if it makes any sense for you to be declaring a popFront which takes an argument.

- Jonathan M Davis