Boost logo

Boost :

Subject: Re: [boost] [BOOST_FOREACH] Problem to iterate on a non-copyable container...
From: nico (nicolas.guillot_at_[hidden])
Date: 2015-05-21 03:26:52


Hello Chris, and thank you for your reply.

I'm feel like an old guy: I don't even ear about move semantic. I wish I'll
be quickly able to work on a modern os and compiler...

For my case, with the old C++, I finally made almost like you: change the
lock to an unqiue lock, and provide a copy constructor:

    MyContainer(const MyContainer& other)
        : m_vector(other.m_vector),
          m_lock(*other.m_lock.mutex())
    {
    }

It's not a move semantic, but it did the job, and is usable with
BOOST_FOREACH.
But I have to change the mutex to a recursive_mutex...

--
View this message in context: http://boost.2283326.n4.nabble.com/BOOST-FOREACH-Problem-to-iterate-on-a-non-copyable-container-tp4675766p4675884.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk