[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: use of deleted function boost::detail::stored_edge_property



Hello Corentin, 

the problem is that the class 

  boost::detail::stored_edge_property<...> 

has the copy constructor deleted, because the default is a move
constructor and no copy constructor is implemented (this is something
new with C++11 and g++-5) As a result the instance of the class can not
be copied. 

Now when you do an append to the vector, and the vector needs to be
resized, the elements stored in the vector will be copied by the STL
implementation. Since this can't be done, the compiler complains. 

Given that the requirements on the type hold in the std::vector
container have been relaxed with C++11 [1], I'm not quite sure whether
what you see is a bug in the stl::vector implementation, because at
resize, the date could be moved to the new storage instead of being
copied. 

In fact the g++-5.3 STL implementation calls a function     

    std::__uninitialized_move_if_noexcept_a 

on resize(), but this only forwards to 

    std::__uninitialized_copy_a

Also note that the implementation of

   boost::detail::stored_edge_property 

provides many code path for the copy and move operations, and before
C++11 an explicit copy constructor is given that implements a move-like
logic. 

I'm not sure how to resolve this compile problem, you could try to
disable c++11 by compiling with -std=c++03. 

Best, 
Gert 

[1] http://en.cppreference.com/w/cpp/container/vector


On Thu, 2016-01-14 at 12:32 +0100, Corentin Desfarges wrote:
> Dear mentors,
> 
> I'm still trying to package the new upstream release of FW4SPL for
> the debian-med project.
> I get a new error, and I wish have your opinion about it :
> 
> > /usr/include/c++/5/bits/vector.tcc:563:7:   required from ‘void
> > std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp,
> > _Alloc>::size_type) [with _Tp =
> > boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
> > boost::vecS, boost::directedS, fwAtomsPatch::VersionDescriptor,
> > fwAtomsPatch::LinkDescriptor>, boost::vecS, boost::listS,
> > boost::directedS, fwAtomsPatch::VersionDescriptor,
> > fwAtomsPatch::LinkDescriptor, boost::no_property,
> > boost::listS>::config::stored_vertex; _Alloc =
> > std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<bo
> > ost::listS, boost::vecS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor>,
> > boost::vecS, boost::listS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor,
> > boost::no_property, boost::listS>::config::stored_vertex>;
> > std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
> > /usr/include/c++/5/bits/stl_vector.h:676:21:   required from ‘void
> > std::vector<_Tp, _Alloc>::resize(std::vector<_Tp,
> > _Alloc>::size_type) [with _Tp =
> > boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
> > boost::vecS, boost::directedS, fwAtomsPatch::VersionDescriptor,
> > fwAtomsPatch::LinkDescriptor>, boost::vecS, boost::listS,
> > boost::directedS, fwAtomsPatch::VersionDescriptor,
> > fwAtomsPatch::LinkDescriptor, boost::no_property,
> > boost::listS>::config::stored_vertex; _Alloc =
> > std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<bo
> > ost::listS, boost::vecS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor>,
> > boost::vecS, boost::listS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor,
> > boost::no_property, boost::listS>::config::stored_vertex>;
> > std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
> > /usr/include/boost/graph/detail/adjacency_list.hpp:2192:7:  
> > required from ‘typename Config::vertex_descriptor
> > boost::add_vertex(boost::vec_adj_list_impl<G, C, B>&) [with Graph =
> > boost::adjacency_list<boost::listS, boost::vecS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor>;
> > Config =
> > boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
> > boost::vecS, boost::directedS, fwAtomsPatch::VersionDescriptor,
> > fwAtomsPatch::LinkDescriptor>, boost::vecS, boost::listS,
> > boost::directedS, fwAtomsPatch::VersionDescriptor,
> > fwAtomsPatch::LinkDescriptor, boost::no_property,
> > boost::listS>::config; Base =
> > boost::directed_graph_helper<boost::detail::adj_list_gen<boost::adj
> > acency_list<boost::listS, boost::vecS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor>,
> > boost::vecS, boost::listS, boost::directedS,
> > fwAtomsPatch::VersionDescriptor, fwAtomsPatch::LinkDescriptor,
> > boost::no_property, boost::listS>::config>; typename
> > Config::vertex_descriptor = long unsigned int]’
> > /home/corentin/dev_0.10.2/fw4spl/SrcLib/core/fwAtomsPatch/src/fwAto
> > msPatch/VersionsGraph.cpp:205:51:   required from here
> > /usr/include/c++/5/bits/stl_list.h:114:71: error: use of deleted
> > function ‘boost::detail::stored_edge_property<long unsigned int,
> > fwAtomsPatch::LinkDescriptor>::stored_edge_property(const
> > boost::detail::stored_edge_property<long unsigned int,
> > fwAtomsPatch::LinkDescriptor>&)’
> >   : __detail::_List_node_base(),
> > _M_data(std::forward<_Args>(__args)...) 
> >                                                                    
> >    ^
> > In file included from
> > /usr/include/boost/graph/adjacency_list.hpp:246:0,
> >                  from
> > /home/corentin/dev_0.10.2/fw4spl/SrcLib/core/fwAtomsPatch/src/fwAto
> > msPatch/VersionsGraph.cpp:9:
> > /usr/include/boost/graph/detail/adjacency_list.hpp:290:11: note:
> > ‘boost::detail::stored_edge_property<long unsigned int,
> > fwAtomsPatch::LinkDescriptor>::stored_edge_property(const
> > boost::detail::stored_edge_property<long unsigned int,
> > fwAtomsPatch::LinkDescriptor>&)’ is implicitly declared as deleted
> > because ‘boost::detail::stored_edge_property<long unsigned int,
> > fwAtomsPatch::LinkDescriptor>’ declares a move constructor or move
> > assignment operator
> >      class stored_edge_property : public stored_edge<Vertex> {
> >            ^
> > fwAtomsPatch/CMakeFiles/fwAtomsPatch.dir/build.make:593: recipe for
> > target
> > 'fwAtomsPatch/CMakeFiles/fwAtomsPatch.dir/src/fwAtomsPatch/Versions
> > Graph.cpp.o' failed
> Complete build log : http://filebin.ca/2TQJYWSTazU1/buidlog.txt
> 
> 
> Does someone have any idea about the cause of this issue ?
> 
> One more time, the concerned lines of FW4SPL haven't changed for a
> long time, and I didn't have any problem before, with an older boost
> version.
> 
> 
> Thank you for your help,
> 
> Best regards,
> 
> 
> Corentin


Reply to: