Boost logo

Boost Users :

From: Christoph (christoph.duelli_at_[hidden])
Date: 2007-02-25 07:03:41


Using gcc with option -W I get the following warning when using a
Boost.MultiIndex container inside a copy constructor:

/usr/local/include/boost-1_33_1/boost/multi_index_container.hpp: In copy
constructor 'boost::multi_index::multi_index_container<Value,
IndexSpecifierList, Allocator>::multi_index_container(const
boost::multi_index::multi_index_container<Value, IndexSpecifierList,
Allocator>&) [with Value = ListenMonitor::ListenZeile, IndexSpecifierList =
boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<ListenMonitor::ListenZeile>,
mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
Allocator = std::allocator<ListenMonitor::ListenZeile>]':
liste.hpp:139: instantiated from here
/usr/local/include/boost-1_33_1/boost/multi_index_container.hpp:204:
warning: base class 'struct
boost::multi_index::detail::header_holder<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<ListenMonitor::ListenZeile>
>, boost::multi_index::multi_index_container<ListenMonitor::ListenZeile,
boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<ListenMonitor::ListenZeile>,
mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
std::allocator<ListenMonitor::ListenZeile> > >' should be explicitly
initialized in the copy constructor

The 'ListenMonitori::Listenzeile' stuff is from me. But the issue does not
depend on that.

I would assume that copying a multi index is not forbidden and using

Is there a way to get rid of that warning? I am trying hard to produce
warning free code, and in this case I am not sure if the warning is just
ugly or if it is a real problem in the code.

[gcc --version:
  gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux) ]

I have attached a trivial example that demonstrates the issue. I have
modified the example/basic.cpp: I have added a trivial class XXX that
contains employee_set. When copying objects of XXX the above warning is
issued by gcc.

Best regards
Christoph




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net