zug
zug copied to clipboard
combining zug::drop_while and zug::last
I have a usecase like:
auto meas = std::vector<pair<size_t, char>>{{0,"a"},{1,"b"},{2,"c"},{3,"d"}};
auto get_timestamps=zug::map([](auto x){
auto [t,b] = x;
return t;
});
auto all_timestamps = meas | get_timestamps;
auto first_ts = all_timestamps | zug::first;
auto after_c = meas | zug::drop_while([first_ts](auto a){ return a.first<first_ts; });
In essence I want a zug::tupilified reduced value to show up in a drop_while test.
This way I have automatic creation of the reduced value to be used as a comparator. I can filter based on the result of some other tail of a transducer chain.
This is a bad example because it would just drop all meas, but assume that I could transduce down to a subset of the full meas and use its last value. I haven't been able to get a recipe that allows its use in something like drop_while.