Boost logo

Boost Users :

Subject: [Boost-users] iterator: zipping and additional function
From: MM (finjulhich_at_[hidden])
Date: 2012-01-29 09:16:54


I have a list of historical datas of this form:

Histodata1 Histodata2 ... Histodatan
1 Jan 1980 Data1 25 Jan 1980 Data2 2 Jan 1980
2 Jan 26 Jan 3 Jan 1980
31 Dec 2004 29 dec 2004 1 dec 2004

This is implemented as

class histodata {
  typedef std::vector<entry>::iterator iterator;
  std::vector<entry> data_;

I need to obtain the union of all this data without duplicating the
individual datas, so I wrote a

class hisodataset { // contains a unique set of histodatas
  /// this contains the n datas
 /// Define the iterator


The requirements of the iterator: bidirectional, but if RanAcc is possible,
it would be good.
. We want the union of datas, so that, if a date is present in at least 1,
then the it should be present in the union. For those histodatas that don't
have the date, it should simply duplicate the last available date for that
. begin() on the set will return the earliest date available for all
.end () will return the "one-after-last" last being the last date available
in all histodatas.

I'm not quite sure how to implement such an iterator.
boost::zip_iterator over the underlying histodatas, but how to add to that
the union part?

only a const version of this union iterator is required, no writing needed.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at