Boost logo

Boost Users :

Subject: Re: [Boost-users] [MultiArray, Intrusive] Instantiating a multi_array of intrusive lists as a class member
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-12-14 11:08:55


On Fri, Dec 14, 2012 at 5:02 AM, Jiri Vyskocil <svzj_at_[hidden]> wrote:

> On Sun, 2012-12-09 at 22:40 -0800, Jeffrey Lee Hellrung, Jr. wrote:
>
> - See if a std::vector< boost::intrusive::list > works.
> >
> This construction compiles and works with gcc 4.7.2 in C++11 mode only.
> With wersion 4.7.2 in default mode and 4.6 in any mode, compilation
> fails with a similar error.
>
> - See if a boost::multi_array< boost::container::vector > works.
> >
> This compiles and works fine in both 4.6 and 4.7, even in non-C++11 mode
>
> If the above nesting of data structures gives similar errors as the
> original combination (something about unavailability of a copy
> constructor and/or stuff involving boost::rv<>), then that would seem to
> confirm it's a Boost.Move + Boost.MultiArray incompatibility. At that
> point, the best options are either to patch Boost.MultiArray to be
> Boost.Move-aware (not sure how much work that would be...) or try gcc
> 4.7.x, where maybe Boost.Move would no longer have adverse effects (if
> rvalue references are enabled by default; I don't know actually if
> that's the case).
> >
> GCC 4.7.2 won't compile the MultiArray of intrusive lists even in C++11
> mode. It spews the same error as gcc 4.6 in C++0x mode:
>
> /usr/include/boost/intrusive/list.hpp:1488:4: error:
> ‘boost::intrusive::list<T, O1, O2, O3>::list(const
> boost::intrusive::list<T, O1, O2, O3>&) [with T = Particle, O1 =
> boost::intrusive::none, O2 = boost::intrusive::none, O3 =
> boost::intrusive::none, boost::intrusive::list<T, O1, O2, O3> =
> boost::intrusive::list<Particle>]’ is private
>
> It would be nice to have this working at least in the newer gcc, but I
> have no idea what to look for...
>

Ah, evidently boost::multiarray expects its value_type to be
copy-constructible (at least), which Boost.Intrusive data structures are
not [1]: "Boost.Intrusive containers are non-copyable and non-assignable."
Also explains the failure of std::vector< boost::intrusive::list >, too, in
C++03 mode. In C++11 mode, I guess std::vector (and similar) are able to
fall back to using the move constructors and assignment operators of the
Boost.Intrusive data structures.

- Jeff

[1]
http://www.boost.org/doc/libs/1_52_0/doc/html/intrusive/intrusive_vs_nontrusive.html



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