[Boost][DateTime] Non conforming iterators?
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
Hi, On 25.06.2015 14:53, dariomt@gmail.com wrote:
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?
Not entirely. An algorithm should use std::iterator_traits to access these types. Among other things this will ensure the algorithm works with pointers. The primary template tries to use nested types within the iterator's class or struct (if any). It seems that DateTime fails to provide all types as nested types *and* fails to specialize std::iterator_traits so it would not have to. But I must admit I only did a cursory "grep" (v 1.55.0).
Am I using these date iterators incorrectly?
It looks correct to me though I don't use DateTime a lot. It does seem the required difference_type is not provided by month_iterator. I'd suggest you check whether this was reported as a bug before, or maybe already fixed in the master branch.
Regards
Cheers, Arne Vogel
participants (2)
-
Arne Vogel
-
dariomt@gmail.com