Boost logo

Boost Users :

Subject: [Boost-users] [Boost][DateTime] Non conforming iterators?
From: dariomt_at_[hidden]
Date: 2015-06-25 08:53:37


Hi,

The documentation for Boost.Date_Time iterators says that "Date iterators
are a model of Bidirectional Iterator".

However, I am not able to use them in some STL algorithms because of the
lack of a required nested type.

The following simplified example does not compile:

#include <boost/date_time/gregorian/gregorian.hpp>
#include <algorithm>
void main()
{
    using namespace boost::gregorian;
    date v[5];
    std::copy_n( month_iterator( date(2015,06,25) ), 5, v );
}

On VS2013 fails with error
'difference_type' : is not a member of
'boost::date_time::date_itr<boost::date_time::month_functor<boost::gregorian::greg_durations_config::date_type>,boost::gregorian::date>'

Compilation on gcc and clang fails with a similar error complaining about
the lack of 'difference_type'.

Isn't a nested difference_type a requirement of BidirectionalIterator?
Am I using these date iterators incorrectly?

Regards



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net