auto osmData = datastream.take(size).array;
    datastream.popFrontN(size);
    auto header = BlobHeader(osmData);

http://he-the-great.livejournal.com/49636.html

How do I know if popFrontN is needed? If I was given a value base range then it is. If I was given a reference range (in its many forms) the extra call to popFrontN will result in an unneeded data jump. I could require that a forward range is passed in, then I can save() before calling .array and thus always require popFrontN.

The best option is probably to use the RefRange wrapper, but it does create an annoying element of surprise.

Yes. I agree. It's good example of problem. I just had problem like this with *take* function, *startsWith* and others. So we have two kinds of ranges: with reference and value semantics. But both of them could be of reference or value *types* (struct or class). So how would we determine at CT (by generic algorithms) wheter current range has ref or value semantics (we couldn't just rely on testing if it's class or struct)!? I think it's important, because it can make influence on programme logic. And again I want to say that we must explicitly say (in doc) that we have two logical range categories, so new users would not make stupid mistakes. Also unittests would be good for ref and value ranges to illustrate our intentions.

Reply via email to