Boost logo

Boost Users :

From: Bryan Green (bryan.d.green_at_[hidden])
Date: 2008-05-16 20:41:18


Hello,

In the interprocess library, move semantics are provided for all the container
types using boost::interprocess::move().

The code for move semantics is (mostly) present in the shared object types and
shared_region, but something is missing for it to actually work for these classes:
the necessary specialization of the 'is_movable' trait, and the correct signature on the
copy constructor and assignment operators.

For example, this does not compile:

//----------------
file_mapping m_file;
{
    file_mapping f("file.bin", ipc::read_write);
    m_file = move(f);
}
//----------------

But this workaround compiles and works as expected:

//----------------
file_mapping m_file;
{
    file_mapping f("file.bin", ipc::read_write);
    detail::moved_object<file_mapping> mf(f);
    m_file = mf;
}
//----------------

Given a simple patch that mirrors what is done for move semantics for the containers,
the first example above will work.

Is there a reason this was left out?
If it is an oversight, would a bug report with a patch file be welcome?

Thanks,
-bryan

---------------------------------------
Bryan Green
Visualization Group
NASA Advanced Supercomputing Division
NASA Ames Research Center
email: bryan.d.green_at_[hidden]
---------------------------------------


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