forked from premiere/premiere-libtorrent
make some types movable (#885)
This commit is contained in:
parent
d9c091f888
commit
cbb6f47f36
|
@ -117,21 +117,16 @@ namespace libtorrent
|
|||
public:
|
||||
// default constructor, does not refer to any session
|
||||
// implementation object.
|
||||
session_proxy() {}
|
||||
session_proxy();
|
||||
~session_proxy();
|
||||
#if __cplusplus >= 201103L
|
||||
session_proxy(session_proxy const&) = default;
|
||||
session_proxy& operator=(session_proxy const&) = default;
|
||||
#endif
|
||||
session_proxy(session_proxy const&);
|
||||
session_proxy& operator=(session_proxy const&);
|
||||
private:
|
||||
session_proxy(
|
||||
boost::shared_ptr<io_service> ios
|
||||
, std::shared_ptr<std::thread> t
|
||||
, boost::shared_ptr<aux::session_impl> impl)
|
||||
: m_io_service(ios)
|
||||
, m_thread(t)
|
||||
, m_impl(impl)
|
||||
{}
|
||||
, boost::shared_ptr<aux::session_impl> impl);
|
||||
|
||||
boost::shared_ptr<io_service> m_io_service;
|
||||
std::shared_ptr<std::thread> m_thread;
|
||||
boost::shared_ptr<aux::session_impl> m_impl;
|
||||
|
@ -149,7 +144,7 @@ namespace libtorrent
|
|||
// the settings to be set and pass it in to ``session::apply_settings()``.
|
||||
//
|
||||
// see apply_settings().
|
||||
class TORRENT_EXPORT session: public boost::noncopyable, public session_handle
|
||||
class TORRENT_EXPORT session : public session_handle
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -172,6 +167,14 @@ namespace libtorrent
|
|||
start(flags, pack, nullptr);
|
||||
}
|
||||
|
||||
// moveable
|
||||
session(session&&) = default;
|
||||
session& operator=(session&&) = default;
|
||||
|
||||
// noncopyable
|
||||
session(session const&) = delete;
|
||||
session& operator=(session const&) = delete;
|
||||
|
||||
// overload of the constructor that takes an external io_service to run
|
||||
// the session object on. This is primarily useful for tests that may want
|
||||
// to run multiple sessions on a single io_service, or low resource
|
||||
|
|
|
@ -69,6 +69,14 @@ namespace libtorrent
|
|||
: m_impl(impl)
|
||||
{}
|
||||
|
||||
// moveable
|
||||
session_handle(session_handle&&) = default;
|
||||
session_handle& operator=(session_handle&&) = default;
|
||||
|
||||
// non copyable
|
||||
session_handle(session_handle const&) = delete;
|
||||
session_handle& operator=(session_handle const&) = delete;
|
||||
|
||||
bool is_valid() const { return m_impl != nullptr; }
|
||||
|
||||
// TODO: 2 the ip filter should probably be saved here too
|
||||
|
|
|
@ -248,12 +248,10 @@ namespace libtorrent
|
|||
// i.e. is_valid() will return false.
|
||||
torrent_handle() {}
|
||||
|
||||
torrent_handle(torrent_handle const& t)
|
||||
{ if (!t.m_torrent.expired()) m_torrent = t.m_torrent; }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
torrent_handle(torrent_handle const& t) = default;
|
||||
torrent_handle(torrent_handle&& t) = default;
|
||||
torrent_handle& operator=(torrent_handle const&) = default;
|
||||
#endif
|
||||
torrent_handle& operator=(torrent_handle&&) = default;
|
||||
|
||||
// flags for add_piece().
|
||||
enum flags_t { overwrite_existing = 1 };
|
||||
|
|
|
@ -398,6 +398,16 @@ namespace libtorrent
|
|||
session_settings::~session_settings() {}
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
session_proxy::session_proxy() = default;
|
||||
session_proxy::session_proxy(boost::shared_ptr<io_service> ios
|
||||
, std::shared_ptr<std::thread> t
|
||||
, boost::shared_ptr<aux::session_impl> impl)
|
||||
: m_io_service(ios)
|
||||
, m_thread(t)
|
||||
, m_impl(impl)
|
||||
{}
|
||||
session_proxy::session_proxy(session_proxy const&) = default;
|
||||
session_proxy& session_proxy::operator=(session_proxy const&) = default;
|
||||
session_proxy::~session_proxy()
|
||||
{
|
||||
if (m_thread && m_thread.unique())
|
||||
|
|
Loading…
Reference in New Issue