Boost C++ Libraries: Ticket #9431: Problem compiling zip_iterator with clang and C++11 https://svn.boost.org/trac10/ticket/9431 <p> The following code fails to compile on OSX 10.8.5 with Xcode 5.0.1 and Boost 1.49.0. This is not real world code, but it demonstrates the problem I'm facing. </p> <pre class="wiki">#include &lt;boost/iterator/zip_iterator.hpp&gt; template&lt;typename T&gt; void foo() { boost::zip_iterator&lt;boost::tuple&lt;T*&gt; &gt; iter; std::fill(iter, iter, boost::make_tuple(T())); } void bar() { foo&lt;int&gt;(); } </pre><p> Here are the commands I used to compile (if I drop "-stdlib=libc++" from the compile line, the code compiles just fine): </p> <pre class="wiki">setenv DEVELOPER_DIR /Applications/Xcode5.0.1.app/Contents/Developer xcrun -sdk macosx10.8 clang++ -c zip_iterator.cpp -I&lt;boost-path&gt;/include -std=c++11 -stdlib=libc++ </pre><p> and here is a heavily formatted snippet of the key error: </p> <pre class="wiki">/Applications/Xcode5.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:1824:1: note: candidate function [with _RandomAccessIterator = boost::zip_iterator&lt;boost::tuples::tuple&lt;int *&gt; &gt;, _Tp = boost::tuples::tuple&lt;int&gt;] not viable: no known conversion from 'typename iterator_traits&lt;zip_iterator&lt;tuple&lt;int *&gt; &gt; &gt;::iterator_category' (aka 'boost::detail::iterator_category_with_traversal&lt;std::__1::input_iterator_tag, boost::random_access_traversal_tag&gt;') to 'std::__1::random_access_iterator_tag' for 4th argument __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp&amp; __value_, random_access_iterator_tag) </pre><p> It appears as if the zip_iterator is not being converted to the correct iterator tag, which is why no calls to std::fill match. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9431 Trac 1.4.3 jonathan.jones@… Wed, 27 Nov 2013 20:27:15 GMT <link>https://svn.boost.org/trac10/ticket/9431#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9431#comment:1</guid> <description> <p> The core problem seems to be this: </p> <pre class="wiki">boost::detail::facade_iterator_category&lt;boost::random_access_traversal_tag, boost::tuple&lt;T&amp;&gt;, boost::tuple&lt;T&amp;&gt; &gt;::type </pre><p> evaluates to the type: </p> <pre class="wiki">boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag, boost::random_access_traversal_tag&gt; </pre><p> This is how zip_iterator instantiates it, with boost::tuple&lt;T&amp;&gt; as both the value and the reference type. </p> <p> The newest implementation of std::fill in Xcode has implementations specific to forward_iterator_tag and random_access_iterator_tag, but not input_iterator_tag, hence the failure to compile. </p> </description> <category>Ticket</category> </item> </channel> </rss>