Boost C++ Libraries: Ticket #10540: missing std::nullptr_t support in boost/type_traits/is_pointer.hpp https://svn.boost.org/trac10/ticket/10540 <p> ...leads to a failures when inserting a nullptr into a boost::ptr_vector: </p> <pre class="wiki">$ cat test.cc #include "boost/ptr_container/nullable.hpp" #include "boost/ptr_container/ptr_vector.hpp" void f(boost::ptr_vector&lt;boost::nullable&lt;int&gt;&gt; &amp; v) { v.insert(v.begin(), nullptr); } $ g++ -std=c++11 -c test.cc In file included from .../boost_1_56_0/boost/ptr_container/nullable.hpp:21:0, from test.cc:1: .../boost_1_56_0/boost/mpl/eval_if.hpp: In instantiation of ‘struct boost::mpl::eval_if_c&lt;true, boost::range_const_iterator&lt;std::nullptr_t, void&gt;, boost::range_mutable_iterator&lt;std::nullptr_t, void&gt; &gt;’: .../boost_1_56_0/boost/range/iterator.hpp:69:17: required from ‘struct boost::range_iterator&lt;std::nullptr_t, void&gt;’ .../boost_1_56_0/boost/range/begin.hpp:106:61: required by substitution of ‘template&lt;class T&gt; typename boost::range_iterator&lt;const T&gt;::type boost::range_adl_barrier::begin(const T&amp;) [with T = std::nullptr_t]’ .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:43: required from ‘typename boost::disable_if&lt;boost::ptr_container_detail::is_pointer_or_integral&lt;Range&gt; &gt;::type boost::ptr_sequence_adapter&lt;T, VoidPtrSeq, CloneAllocator&gt;::insert(boost::ptr_sequence_adapter&lt;T, VoidPtrSeq, CloneAllocator&gt;::iterator, const Range&amp;) [with Range = std::nullptr_t; T = boost::nullable&lt;int&gt;; VoidPtrSeq = std::vector&lt;void*, std::allocator&lt;void*&gt; &gt;; CloneAllocator = boost::heap_clone_allocator; typename boost::disable_if&lt;boost::ptr_container_detail::is_pointer_or_integral&lt;Range&gt; &gt;::type = void; boost::ptr_sequence_adapter&lt;T, VoidPtrSeq, CloneAllocator&gt;::iterator = boost::void_ptr_iterator&lt;__gnu_cxx::__normal_iterator&lt;void**, std::vector&lt;void*, std::allocator&lt;void*&gt; &gt; &gt;, int&gt;]’ test.cc:4:32: required from here .../boost_1_56_0/boost/mpl/eval_if.hpp:60:31: error: no type named ‘type’ in ‘boost::mpl::eval_if_c&lt;true, boost::range_const_iterator&lt;std::nullptr_t, void&gt;, boost::range_mutable_iterator&lt;std::nullptr_t, void&gt; &gt;::f_ {aka struct boost::range_const_iterator&lt;std::nullptr_t, void&gt;}’ typedef typename f_::type type; ^ In file included from .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20:0, from test.cc:2: .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp: In instantiation of ‘typename boost::disable_if&lt;boost::ptr_container_detail::is_pointer_or_integral&lt;Range&gt; &gt;::type boost::ptr_sequence_adapter&lt;T, VoidPtrSeq, CloneAllocator&gt;::insert(boost::ptr_sequence_adapter&lt;T, VoidPtrSeq, CloneAllocator&gt;::iterator, const Range&amp;) [with Range = std::nullptr_t; T = boost::nullable&lt;int&gt;; VoidPtrSeq = std::vector&lt;void*, std::allocator&lt;void*&gt; &gt;; CloneAllocator = boost::heap_clone_allocator; typename boost::disable_if&lt;boost::ptr_container_detail::is_pointer_or_integral&lt;Range&gt; &gt;::type = void; boost::ptr_sequence_adapter&lt;T, VoidPtrSeq, CloneAllocator&gt;::iterator = boost::void_ptr_iterator&lt;__gnu_cxx::__normal_iterator&lt;void**, std::vector&lt;void*, std::allocator&lt;void*&gt; &gt; &gt;, int&gt;]’: test.cc:4:32: required from here .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:43: error: no matching function for call to ‘begin(std::nullptr_t&amp;)’ insert( before, boost::begin(r), boost::end(r) ); ^ .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:43: note: candidates are: In file included from .../boost_1_56_0/boost/range/functions.hpp:18:0, from .../boost_1_56_0/boost/ptr_container/detail/reversible_ptr_container.hpp:29, from .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:20, from .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20, from test.cc:2: .../boost_1_56_0/boost/range/begin.hpp:97:55: note: template&lt;class T&gt; typename boost::range_iterator&lt;C&gt;::type boost::range_adl_barrier::begin(T&amp;) inline BOOST_DEDUCED_TYPENAME range_iterator&lt;T&gt;::type begin( T&amp; r ) ^ .../boost_1_56_0/boost/range/begin.hpp:97:55: note: template argument deduction/substitution failed: .../boost_1_56_0/boost/range/begin.hpp:106:61: note: template&lt;class T&gt; typename boost::range_iterator&lt;const T&gt;::type boost::range_adl_barrier::begin(const T&amp;) inline BOOST_DEDUCED_TYPENAME range_iterator&lt;const T&gt;::type begin( const T&amp; r ) ^ .../boost_1_56_0/boost/range/begin.hpp:106:61: note: substitution of deduced template arguments resulted in errors seen above In file included from .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20:0, from test.cc:2: .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:58: error: no matching function for call to ‘end(std::nullptr_t&amp;)’ insert( before, boost::begin(r), boost::end(r) ); ^ .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:58: note: candidates are: In file included from .../boost_1_56_0/boost/range/functions.hpp:19:0, from .../boost_1_56_0/boost/ptr_container/detail/reversible_ptr_container.hpp:29, from .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:20, from .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20, from test.cc:2: .../boost_1_56_0/boost/range/end.hpp:91:55: note: template&lt;class T&gt; typename boost::range_iterator&lt;C&gt;::type boost::range_adl_barrier::end(T&amp;) inline BOOST_DEDUCED_TYPENAME range_iterator&lt;T&gt;::type end( T&amp; r ) ^ .../boost_1_56_0/boost/range/end.hpp:91:55: note: template argument deduction/substitution failed: .../boost_1_56_0/boost/range/end.hpp:100:61: note: template&lt;class T&gt; typename boost::range_iterator&lt;const T&gt;::type boost::range_adl_barrier::end(const T&amp;) inline BOOST_DEDUCED_TYPENAME range_iterator&lt;const T&gt;::type end( const T&amp; r ) ^ .../boost_1_56_0/boost/range/end.hpp:100:61: note: template argument deduction/substitution failed: </pre><p> What would fix this is: </p> <pre class="wiki">--- boost/type_traits/is_pointer.hpp 2014-07-09 20:04:22.000000000 +0200 +++ boost/type_traits/is_pointer.hpp 2014-09-25 15:37:45.895757102 +0200 @@ -72,6 +72,10 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl&lt;T&gt;::value) +#if !defined( BOOST_NO_CXX11_NULLPTR ) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pointer,::std::nullptr_t,true) +#endif + #if defined(__BORLANDC__) &amp;&amp; !defined(__COMO__) &amp;&amp; (__BORLANDC__ &lt; 0x600) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&amp;,false) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&amp; const,false) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10540 Trac 1.4.3 John Maddock Thu, 25 Sep 2014 16:06:11 GMT owner, component changed https://svn.boost.org/trac10/ticket/10540#comment:1 https://svn.boost.org/trac10/ticket/10540#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">John Maddock</span> to <span class="trac-author">Thorsten Ottosen</span> </li> <li><strong>component</strong> <span class="trac-field-old">type_traits</span> → <span class="trac-field-new">ptr_container</span> </li> </ul> <p> That's not the right fix - std::nullptr_t <em>is not a pointer type</em> - it's a type that's convertible to a pointer which is a whole other ball game. </p> <p> I believe the correct fix is for ptr_container to provide an explicit overload for std::nullptr_t for methods like insert. Reassigning in case someone wants to apply a fix there. </p> Ticket Stephan Bergmann <sbergman@…> Thu, 25 Sep 2014 16:21:15 GMT <link>https://svn.boost.org/trac10/ticket/10540#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10540#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10540#comment:1" title="Comment 1">johnmaddock</a>: </p> <blockquote class="citation"> <p> That's not the right fix - std::nullptr_t <em>is not a pointer type</em> - it's a type that's convertible to a pointer which is a whole other ball game. </p> </blockquote> <p> Ach, right. My bad. </p> </description> <category>Ticket</category> </item> </channel> </rss>