Skip to content

Commit 9bb9ac0

Browse files
committed
Fix Wsign-conversion warnings
1 parent 6f39505 commit 9bb9ac0

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

experimental/bench_hub.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,29 +403,29 @@ void write_table(const table& t, const char* filename)
403403

404404
out << data_horizontal_line << "\n";
405405

406-
out << " " << std::setw(first_column_width) << " ";
407-
out << std::setw(table_width - first_column_width - 3)
406+
out << " " << std::setw(static_cast<int>(first_column_width)) << " ";
407+
out << std::setw(static_cast<int>(table_width - first_column_width - 3))
408408
<< std::string("| sizeof(element): ") + std::to_string(ELEMENT_SIZE) << "|\n";
409409

410410
out << data_horizontal_line << "\n";
411411

412-
out << " " << std::setw(first_column_width) << " ";
412+
out << " " << std::setw(static_cast<int>(first_column_width)) << " ";
413413
for(const benchmark_result& res: t) {
414-
out << "| " << std::setw(data_column_width) << res.title;
414+
out << "| " << std::setw(static_cast<int>(data_column_width)) << res.title;
415415
}
416416
out << "|\n";
417417

418418
out << data_horizontal_line << "\n";
419419

420-
out << " " << std::setw(first_column_width) << " " ;
420+
out << " " << std::setw(static_cast<int>(first_column_width)) << " " ;
421421
for(std::size_t i = 0; i < num_data_columns; ++i) {
422-
out << "| " << std::setw(data_column_width) << "container size";
422+
out << "| " << std::setw(static_cast<int>(data_column_width)) << "container size";
423423
}
424424
out << "|\n";
425425

426426
out << table_horizontal_line << "\n";
427427

428-
out << "| " << std::setw(first_column_width) << "erase rate";
428+
out << "| " << std::setw(static_cast<int>(first_column_width)) << "erase rate";
429429
for(std::size_t i = 0; i < num_data_columns; ++i) {
430430
out << "| ";
431431
for(auto j = min_size_exp; j <= max_size_exp; ++j) {
@@ -440,7 +440,7 @@ void write_table(const table& t, const char* filename)
440440
for(double erasure_rate = min_erasure_rate;
441441
erasure_rate <= max_erasure_rate;
442442
erasure_rate += erase_rate_inc, ++row) {
443-
out << "| " << std::setw(first_column_width) << erasure_rate;
443+
out << "| " << std::setw(static_cast<int>(first_column_width)) << erasure_rate;
444444
for(const benchmark_result& res: t) {
445445
out << "| ";
446446
for(const auto& x: res.data[row]) {

include/boost/container/experimental/hub.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,32 +561,32 @@ struct sort_iterator
561561

562562
sort_iterator& operator+=(difference_type n) noexcept
563563
{
564-
index += n;
564+
index += static_cast<std::size_t>(n);
565565
return *this;
566566
}
567567

568568
friend sort_iterator
569569
operator+(const sort_iterator& x, difference_type n) noexcept
570570
{
571-
return {x.pp, x.index + n};
571+
return {x.pp, x.index + static_cast<std::size_t>(n)};
572572
}
573573

574574
friend sort_iterator
575575
operator+(difference_type n, const sort_iterator& x) noexcept
576576
{
577-
return {x.pp, n + x.index};
577+
return {x.pp, static_cast<std::size_t>(n) + x.index};
578578
}
579579

580580
sort_iterator& operator-=(difference_type n) noexcept
581581
{
582-
index -= n;
582+
index -= static_cast<std::size_t>(n);
583583
return *this;
584584
}
585585

586586
friend sort_iterator
587587
operator-(const sort_iterator& x, difference_type n) noexcept
588588
{
589-
return {x.pp, x.index - n};
589+
return {x.pp, x.index - static_cast<std::size_t>(n)};
590590
}
591591

592592
reference operator[](difference_type n) const noexcept
@@ -1653,7 +1653,7 @@ class hub: empty_value<
16531653
void compact_sort(Compare comp)
16541654
{
16551655
/* compact elements and build an array of pointers to data chunks of N */
1656-
using sort_iterator = hub_detail::sort_iterator<T, N>;
1656+
using sort_iterator = hub_detail::sort_iterator<T, static_cast<std::size_t>(N)>;
16571657

16581658
if(size_ > 1) {
16591659
std::size_t n = (std::size_t)((size_ + N - 1) / N);

0 commit comments

Comments
 (0)