It appears that zip_iterator, evaluates iterator_category to std::input_iterator_tag for the below code snippet.
But the implementation of std::fill in Xcode(i'm using Xcode10.1.0.app) has implementations specific to forward_iterator_tag and random_access_iterator_tag, but not input_iterator_tag. Thus the code results in the compilation error.
The same code compiles fine with gcc-6.3.0.
//zip_iterator.cpp
#include <boost/iterator/zip_iterator.hpp>
#include <iterator>
#include <iostream>
template <typename Iterator>
void FooImpl(Iterator first, Iterator last, std::input_iterator_tag ) {
std::cout<< "Input Iteartor Tag\n";
}
template <typename Iterator>
void Foo(Iterator first, Iterator last) {
typedef typename std::iterator_traits<Iterator>::iterator_category category;
FooImpl(first, last, category());
}
template<typename T>
void foo()
{
boost::zip_iterator<boost::tuple<T*> > iter;
Foo(iter,iter);
std::fill(iter, iter, boost::make_tuple(T())); //Fails to compile
}
int main()
{
foo<int>();
return 0;
}
Is it a bug in boost zip_iterator that it generates "std::input_iterator_tag" as iterator_category,
OR
std::fill version of std::input_iterator_tag is missing in Xcode(clang) ?