clean up noexcept specifiers to adapt to what the implementation provides
This commit is contained in:
parent
421709f67f
commit
53b4725da3
|
@ -89,8 +89,7 @@ namespace libtorrent {
|
|||
// data for the torrent. For more information, see the ``storage`` field.
|
||||
explicit add_torrent_params(storage_constructor_type sc = default_storage_constructor);
|
||||
add_torrent_params(add_torrent_params&&) noexcept;
|
||||
// TODO: GCC did not make std::string nothrow move-assignable
|
||||
add_torrent_params& operator=(add_torrent_params&&);
|
||||
add_torrent_params& operator=(add_torrent_params&&) = default;
|
||||
add_torrent_params(add_torrent_params const&);
|
||||
add_torrent_params& operator=(add_torrent_params const&);
|
||||
|
||||
|
|
|
@ -44,26 +44,15 @@ namespace aux {
|
|||
template <typename T>
|
||||
struct noexcept_movable : T
|
||||
{
|
||||
noexcept_movable() noexcept(std::is_nothrow_default_constructible<T>::value) {}
|
||||
noexcept_movable() = default;
|
||||
noexcept_movable(noexcept_movable<T>&& rhs) noexcept
|
||||
: T(std::forward<T>(rhs))
|
||||
{}
|
||||
noexcept_movable(noexcept_movable<T> const& rhs)
|
||||
: T(static_cast<T const&>(rhs))
|
||||
{}
|
||||
noexcept_movable(noexcept_movable<T> const& rhs) = default;
|
||||
noexcept_movable(T&& rhs) noexcept : T(std::forward<T>(rhs)) {} // NOLINT
|
||||
noexcept_movable(T const& rhs) : T(rhs) {} // NOLINT
|
||||
noexcept_movable& operator=(noexcept_movable&& rhs) noexcept
|
||||
{
|
||||
this->T::operator=(std::forward<T>(rhs));
|
||||
return *this;
|
||||
}
|
||||
noexcept_movable& operator=(noexcept_movable const& rhs)
|
||||
{
|
||||
this->T::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
noexcept_movable& operator=(noexcept_movable const& rhs) = default;
|
||||
noexcept_movable& operator=(noexcept_movable&& rhs) = default;
|
||||
using T::T;
|
||||
using T::operator=;
|
||||
};
|
||||
|
|
|
@ -258,14 +258,14 @@ struct TORRENT_EXPORT bdecode_node
|
|||
, error_code& ec, int* error_pos, int depth_limit, int token_limit);
|
||||
|
||||
// creates a default constructed node, it will have the type ``none_t``.
|
||||
bdecode_node();
|
||||
bdecode_node() = default;
|
||||
|
||||
// For owning nodes, the copy will create a copy of the tree, but the
|
||||
// underlying buffer remains the same.
|
||||
bdecode_node(bdecode_node const&);
|
||||
bdecode_node& operator=(bdecode_node const&);
|
||||
bdecode_node(bdecode_node&&) noexcept;
|
||||
bdecode_node& operator=(bdecode_node&&) noexcept;
|
||||
bdecode_node& operator=(bdecode_node&&) = default;
|
||||
|
||||
// the types of bdecoded nodes
|
||||
enum type_t
|
||||
|
@ -377,25 +377,25 @@ private:
|
|||
|
||||
// this points to the root nodes token vector
|
||||
// for the root node, this points to its own m_tokens member
|
||||
detail::bdecode_token const* m_root_tokens;
|
||||
detail::bdecode_token const* m_root_tokens = nullptr;
|
||||
|
||||
// this points to the original buffer that was parsed
|
||||
char const* m_buffer;
|
||||
int m_buffer_size;
|
||||
char const* m_buffer = nullptr;
|
||||
int m_buffer_size = 0;
|
||||
|
||||
// this is the index into m_root_tokens that this node refers to
|
||||
// for the root node, it's 0. -1 means uninitialized.
|
||||
int m_token_idx;
|
||||
int m_token_idx = -1;
|
||||
|
||||
// this is a cache of the last element index looked up. This only applies
|
||||
// to lists and dictionaries. If the next lookup is at m_last_index or
|
||||
// greater, we can start iterating the tokens at m_last_token.
|
||||
mutable int m_last_index;
|
||||
mutable int m_last_token;
|
||||
mutable int m_last_index = -1;
|
||||
mutable int m_last_token = -1;
|
||||
|
||||
// the number of elements in this list or dict (computed on the first
|
||||
// call to dict_size() or list_size())
|
||||
mutable int m_size;
|
||||
mutable int m_size = -1;
|
||||
};
|
||||
|
||||
// print the bencoded structure in a human-readable format to a string
|
||||
|
@ -430,10 +430,10 @@ TORRENT_EXPORT std::string print_entry(bdecode_node const& e
|
|||
// simply produces references back into it.
|
||||
TORRENT_EXPORT int bdecode(char const* start, char const* end, bdecode_node& ret
|
||||
, error_code& ec, int* error_pos = nullptr, int depth_limit = 100
|
||||
, int token_limit = 1000000);
|
||||
, int token_limit = 2000000);
|
||||
TORRENT_EXPORT bdecode_node bdecode(span<char const> buffer
|
||||
, error_code& ec, int* error_pos = nullptr, int depth_limit = 100
|
||||
, int token_limit = 1000000);
|
||||
, int token_limit = 2000000);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/sha1_hash.hpp"
|
||||
#include "libtorrent/string_view.hpp"
|
||||
#include "libtorrent/aux_/vector.hpp"
|
||||
#include "libtorrent/aux_/noexcept_movable.hpp"
|
||||
#include "libtorrent/flags.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
@ -211,7 +210,7 @@ namespace libtorrent {
|
|||
file_storage(file_storage const&);
|
||||
file_storage& operator=(file_storage const&);
|
||||
file_storage(file_storage&&) noexcept;
|
||||
file_storage& operator=(file_storage&&) noexcept;
|
||||
file_storage& operator=(file_storage&&) = default;
|
||||
|
||||
// returns true if the piece length has been initialized
|
||||
// on the file_storage. This is typically taken as a proxy
|
||||
|
@ -593,7 +592,7 @@ namespace libtorrent {
|
|||
|
||||
// name of torrent. For multi-file torrents
|
||||
// this is always the root directory
|
||||
aux::noexcept_movable<std::string> m_name;
|
||||
std::string m_name;
|
||||
|
||||
// the sum of all file sizes
|
||||
std::int64_t m_total_size;
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace aux {
|
|||
|
||||
// constructs a torrent handle that does not refer to a torrent.
|
||||
// i.e. is_valid() will return false.
|
||||
torrent_handle() noexcept {}
|
||||
torrent_handle() noexcept = default;
|
||||
|
||||
torrent_handle(torrent_handle const& t) = default;
|
||||
torrent_handle(torrent_handle&& t) noexcept = default;
|
||||
|
|
|
@ -58,8 +58,6 @@ namespace libtorrent {
|
|||
torrent_status(torrent_status const&);
|
||||
torrent_status& operator=(torrent_status const&);
|
||||
torrent_status(torrent_status&&) noexcept;
|
||||
// TODO: 2 msvc and GCC did not make std::string nothrow move-assignable
|
||||
// until C++17
|
||||
torrent_status& operator=(torrent_status&&);
|
||||
|
||||
// compares if the torrent status objects come from the same torrent. i.e.
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace libtorrent {
|
|||
add_torrent_params::add_torrent_params(storage_constructor_type sc)
|
||||
: storage(std::move(sc)) {}
|
||||
add_torrent_params::add_torrent_params(add_torrent_params&&) noexcept = default;
|
||||
add_torrent_params& add_torrent_params::operator=(add_torrent_params&&) = default;
|
||||
add_torrent_params::add_torrent_params(add_torrent_params const&) = default;
|
||||
add_torrent_params& add_torrent_params::operator=(add_torrent_params const&) = default;
|
||||
|
||||
|
|
|
@ -202,16 +202,6 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
bdecode_node::bdecode_node()
|
||||
: m_root_tokens(nullptr)
|
||||
, m_buffer(nullptr)
|
||||
, m_buffer_size(0)
|
||||
, m_token_idx(-1)
|
||||
, m_last_index(-1)
|
||||
, m_last_token(-1)
|
||||
, m_size(-1)
|
||||
{}
|
||||
|
||||
bdecode_node::bdecode_node(bdecode_node const& n)
|
||||
: m_tokens(n.m_tokens)
|
||||
, m_root_tokens(n.m_root_tokens)
|
||||
|
@ -246,7 +236,6 @@ namespace {
|
|||
}
|
||||
|
||||
bdecode_node::bdecode_node(bdecode_node&&) noexcept = default;
|
||||
bdecode_node& bdecode_node::operator=(bdecode_node&&) noexcept = default;
|
||||
|
||||
bdecode_node::bdecode_node(bdecode_token const* tokens, char const* buf
|
||||
, int len, int idx)
|
||||
|
|
|
@ -81,7 +81,6 @@ namespace libtorrent {
|
|||
file_storage::file_storage(file_storage const&) = default;
|
||||
file_storage& file_storage::operator=(file_storage const&) = default;
|
||||
file_storage::file_storage(file_storage&&) noexcept = default;
|
||||
file_storage& file_storage::operator=(file_storage&&) noexcept = default;
|
||||
|
||||
void file_storage::reserve(int num_files)
|
||||
{
|
||||
|
|
|
@ -49,8 +49,6 @@ namespace libtorrent {
|
|||
|
||||
static_assert(std::is_nothrow_move_constructible<torrent_status>::value
|
||||
, "should be nothrow move constructible");
|
||||
// static_assert(std::is_nothrow_move_assignable<torrent_status>::value
|
||||
// , "should be nothrow move assignable");
|
||||
static_assert(std::is_nothrow_default_constructible<torrent_status>::value
|
||||
, "should be nothrow default constructible");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue