fix IndexType template parameter in typed_span member functions (#1819)

fix IndexType template parameter in typed_span member functions
This commit is contained in:
Alden Torres 2017-03-17 18:15:11 -04:00 committed by Arvid Norberg
parent a7934594fe
commit dba94a9276
3 changed files with 9 additions and 11 deletions

View File

@ -64,13 +64,13 @@ namespace libtorrent { namespace aux {
template <typename U = underlying_index, typename Cond
= typename std::enable_if<std::is_signed<U>::value>::type>
typed_span<T> first(underlying_index n) const
typed_span first(underlying_index n) const
{
TORRENT_ASSERT(n >= 0);
return this->base::first(std::size_t(n));
}
typed_span<T> first(std::size_t n) const
typed_span first(std::size_t n) const
{
TORRENT_ASSERT(n <= std::size_t((std::numeric_limits<underlying_index>::max)()));
return this->base::first(n);
@ -78,13 +78,13 @@ namespace libtorrent { namespace aux {
template <typename U = underlying_index, typename Cond
= typename std::enable_if<std::is_signed<U>::value>::type>
typed_span<T> last(underlying_index n) const
typed_span last(underlying_index n) const
{
TORRENT_ASSERT(n >= 0);
return this->base::last(std::size_t(n));
}
typed_span<T> last(std::size_t n) const
typed_span last(std::size_t n) const
{
TORRENT_ASSERT(n <= std::size_t((std::numeric_limits<underlying_index>::max)()));
return this->base::last(n);
@ -92,7 +92,7 @@ namespace libtorrent { namespace aux {
template <typename U = underlying_index, typename Cond
= typename std::enable_if<std::is_signed<U>::value>::type>
typed_span<T> subspan(underlying_index offset) const
typed_span subspan(underlying_index offset) const
{
TORRENT_ASSERT(offset >= 0);
return this->base::subspan(std::size_t(offset));
@ -100,20 +100,20 @@ namespace libtorrent { namespace aux {
template <typename U = underlying_index, typename Cond
= typename std::enable_if<std::is_signed<U>::value>::type>
typed_span<T> subspan(underlying_index offset, underlying_index count) const
typed_span subspan(underlying_index offset, underlying_index count) const
{
TORRENT_ASSERT(offset >= 0);
TORRENT_ASSERT(count >= 0);
return this->base::subspan(std::size_t(offset), std::size_t(count));
}
typed_span<T> subspan(std::size_t offset) const
typed_span subspan(std::size_t offset) const
{
TORRENT_ASSERT(offset <= std::size_t((std::numeric_limits<underlying_index>::max)()));
return this->base::subspan(offset);
}
typed_span<T> subspan(std::size_t offset, std::size_t count) const
typed_span subspan(std::size_t offset, std::size_t count) const
{
TORRENT_ASSERT(offset <= std::size_t((std::numeric_limits<underlying_index>::max)()));
TORRENT_ASSERT(count <= std::size_t((std::numeric_limits<underlying_index>::max)()));

View File

@ -558,4 +558,3 @@ namespace libtorrent { namespace aux
}
}}

View File

@ -106,7 +106,7 @@ void test_remap_files(storage_mode_t storage_mode = storage_mode_sparse)
}
// wait for all alerts to come back and verify the data against the expected
// piece adata
// piece data
aux::vector<bool, piece_index_t> pieces(fs.num_pieces(), false);
aux::vector<bool, piece_index_t> passed(fs.num_pieces(), false);
aux::vector<bool, file_index_t> files(fs.num_files(), false);
@ -200,4 +200,3 @@ TORRENT_TEST(remap_files)
{
test_remap_files();
}