3 ms·
Unfortunately, tee's are backed by a queue and upon each read of a "fresh" value from one of the branches of the tee, the shared queue is appended to. There is
by knappa 8y ago
Unfortunately, tee's are backed by a queue and upon each read of a "fresh" value from one of the branches of the tee, the shared queue is appended to. There is no opportunity to remove an element from the queue until all branches of the tee have consumed it, so this will end up using O(n) memory as squares_min is completely consumed before squares_max is accessed. (Alternatingly calling next on the branches of the tee will solve the issue.) See the "Roughly equivalent to" and immediately previous text in your link.