Skip to content

Commit 1eded9b

Browse files
committed
Fix warnings for old GCCs and make it work without exceptions
1 parent c0549ea commit 1eded9b

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

experimental/bench_hub.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,22 @@ struct create_and_destroy
295295
template<typename Container>
296296
struct prepare
297297
{
298-
const Container& get_container(std::size_t n_, double erasure_rate_)
298+
const Container& get_container(std::size_t n_arg, double erasure_rate_arg)
299299
{
300-
if(n_ != n || erasure_rate_ != erasure_rate) {
300+
if(n_arg != n_ || erasure_rate_arg != erasure_rate_) {
301301
pause_timing();
302-
n = n_;
303-
erasure_rate = erasure_rate_;
302+
n_ = n_arg;
303+
erasure_rate_ = erasure_rate_arg;
304304
c.clear();
305305
c.shrink_to_fit();
306-
c = make<Container>(n, erasure_rate);
306+
c = make<Container>(n_, erasure_rate_);
307307
resume_timing();
308308
}
309309
return c;
310310
}
311311

312-
std::size_t n = 0;
313-
double erasure_rate = 0.0;
312+
std::size_t n_ = 0;
313+
double erasure_rate_ = 0.0;
314314
Container c;
315315
};
316316

@@ -320,8 +320,8 @@ struct for_each: prepare<Container>
320320
unsigned int operator()(std::size_t n, double erasure_rate)
321321
{
322322
unsigned int res = 0;
323-
auto& c = this->get_container(n, erasure_rate);
324-
for(const auto& x: c) res += (unsigned int)x;
323+
auto& cr = this->get_container(n, erasure_rate);
324+
for(const auto& x: cr) res += (unsigned int)x;
325325
return res;
326326
}
327327
};
@@ -332,8 +332,8 @@ struct visit_all: prepare<Container>
332332
unsigned int operator()(std::size_t n, double erasure_rate)
333333
{
334334
unsigned int res = 0;
335-
auto& c = this->get_container(n, erasure_rate);
336-
c.visit_all([&] (const auto& x) { res += (unsigned int)x; });
335+
auto& cr = this->get_container(n, erasure_rate);
336+
cr.visit_all([&] (const auto& x) { res += (unsigned int)x; });
337337
return res;
338338
}
339339
};
@@ -464,7 +464,7 @@ int main(int argc,char* argv[])
464464
(void)argv;
465465

466466
using namespace boost::container;
467-
try{
467+
BOOST_CONTAINER_TRY{
468468
#ifdef PLF_HIVE_BENCH
469469
using num = plf::hive<element>;
470470
#else
@@ -505,9 +505,12 @@ int main(int argc,char* argv[])
505505
std::cout << std::left << std::setw(30) << "OVERALL"
506506
<< std::fixed << std::setprecision(3) << geomean(t) << "\n";
507507
}
508-
catch(const std::exception& e) {
508+
BOOST_CONTAINER_CATCH(const std::exception& e) {
509+
#ifndef BOOST_NO_EXCEPTIONS
509510
std::cerr << e.what() << std::endl;
511+
#endif
510512
}
513+
BOOST_CONTAINER_CATCH_END
511514
}
512515

513516
#endif

0 commit comments

Comments
 (0)