id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 3996,Enable use of BOOST_FOREACH over const-ref of noncopyable ptr_containers,Kazutoshi Satoda ,Thorsten Ottosen,"I have encountered an error about allocating abstract type, with the following code: {{{ #include ""boost/ptr_container/ptr_vector.hpp"" #include ""boost/foreach.hpp"" struct S { virtual void f() const = 0; }; typedef boost::ptr_vector ptr_vector; void f(ptr_vector const& v) { BOOST_FOREACH(S const& s, v) s.f(); } }}} And I found this is a known issue: [http://www.boost.org/doc/libs/1_42_0/doc/html/foreach/extensibility.html#id862475 Boost.Foreach > Extensibility] Then I thought that boost::foreach::is_noncopyable<> should be specialized for ptr_containers of which value_type is abstruct. Then I put the following: {{{ namespace boost { namespace foreach { template struct is_noncopyable > : is_abstract {}; }} }}} ... and the error disappeared. After that, since ptr_container is designed to be an alternative of the standard containers for the case of the value is non-copyable, I thought this is a wide problem worth making a patch. The patch looks better than the above workaround in some points: - fixes the problem for all ptr_containers at once - also supports types marked by boost::noncopyable - keeps the container copyable if view_clone_allocator is used The patch also includes some test cases I actually used, while I have no idea how to integrate it into boost test infrastructure. ",Patches,reopened,To Be Determined,ptr_container,Boost Development Trunk,Problem,,BOOST_FOREACH is_noncopyable,jonathan.jones@…