460 reputation
312
bio website github.com/aaronjosephs
location New York, NYC
age 23
visits member for 1 year, 4 months
seen Dec 4 at 23:09

Graduated in 2013 with a degree in computer science from Binghamton University. Junior Software Engineer at placeiq.

Github

Python itertools in C++


Aug
18
awarded  Yearling
Aug
5
awarded  Notable Question
Jun
22
awarded  Popular Question
Nov
21
awarded  Popular Question
Sep
25
accepted Is it bad practice to make an iterator that is aware of its own end
Sep
25
comment Is it bad practice to make an iterator that is aware of its own end
I mean that's basically what I ended up doing, IDK if you looked at the code, the first iter is the generator and end is essentially a dummy iter
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
There is nothing wrong with your answer but the point is that c++ range based for loops expect an object that has begin and end functions which is why my object may function like a range but in the end has to return two iterators
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
@congusbongus not exactly, mine is varaidic, boost::join is just 2 ranges, also I'm just doing this for fun
Sep
24
answered Is it bad practice to make an iterator that is aware of its own end
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
@jozefg no you never answered it, and my code would actually work with a file and a vector of strings because their iterators should deref to the same type. But with pythons chain you can just use whatever containers you want
Sep
24
revised Is it bad practice to make an iterator that is aware of its own end
added 3289 characters in body
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
@jozefg jeez what's the downvote for, I feel like your not even addressing my question which is, is there anything wrong with having an iterator that stops itself
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
@jozefg no I decided it should only work if the iterators in the ranges dereference to the same type, you would have to do some weird stuff to make chain work with multiple types at once and it would end up being more obtrusive for the user, and in python you definitely pass the containers not iterators, as for the range based for loop the point is that chain creates a range you can use with that
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
@jozefg maybe I didn't explain it perfectly, chain takes advantage of the new range based for loop in c++ like so for(auto i : chain(vec1,vec1,vec3){}, I know how the stdlib functions work but this is different and I don't think I can use your solution
Sep
24
comment Is it bad practice to make an iterator that is aware of its own end
@jozefg well I already have it working, but can you explain your solution more clearly, where are you passing the iterators to, just so you know my chain works identically to python's
Sep
24
asked Is it bad practice to make an iterator that is aware of its own end
Sep
16
awarded  Enthusiast
Sep
8
comment How long is a typical modern microprocessor pipeline?
I think you can expect them to be in the 20's but my memory is rusty
Sep
2
awarded  Citizen Patrol
Sep
1
awarded  Editor