Boost logo

Boost Users :

Subject: [Boost-users] [Boost-Users] Boost::Thread: scoped thread using boost::move
From: Boost lzw (boostlzw_at_[hidden])
Date: 2010-03-23 18:49:14


Hello folks,

The following scoped_thread that I wrote runs well with boost 1.42.0:
#include <boost/thread/thread.hpp>
#include <iostream>

class scoped_thread {
    boost::thread t;
    scoped_thread(const scoped_thread&);
    scoped_thread operator=(const scoped_thread&);
public:
    scoped_thread(boost::thread t_) : t(boost::move(t_) ) {
        if (!t.joinable() )
            throw;
    }
    ~scoped_thread () {
        t.join();
    }
};

However, as you may notice I did not include <move.hpp> and did use
boost::move in the ctor. Is the true std::move semantics already available
on boost 1.42.0 by just including <boost/thread/thread.hpp>? If so (as my
code illustrates), that would be nice.

Cheers,
Robert



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