@@ -213,17 +213,17 @@ static void test3_insert()
213
213
214
214
#if defined(BSLS_PLATFORM_OS_SOLARIS)
215
215
// Avoid timeout on Solaris
216
- const int k_NUM_ELEMENTS = 100 * 1000 ; // 100K
216
+ const size_t k_NUM_ELEMENTS = 100 * 1000 ; // 100K
217
217
#elif defined(__has_feature)
218
218
// Avoid timeout under MemorySanitizer
219
- const int k_NUM_ELEMENTS = __has_feature (memory_sanitizer)
220
- ? 100 * 1000 // 100K
221
- : 1000 * 1000 ; // 1M
219
+ const size_t k_NUM_ELEMENTS = __has_feature (memory_sanitizer)
220
+ ? 100 * 1000 // 100K
221
+ : 1000 * 1000 ; // 1M
222
222
#elif defined(__SANITIZE_MEMORY__)
223
223
// GCC-supported macros for checking MSAN
224
- const int k_NUM_ELEMENTS = 100 * 1000 ; // 100K
224
+ const size_t k_NUM_ELEMENTS = 100 * 1000 ; // 100K
225
225
#else
226
- const int k_NUM_ELEMENTS = 1000 * 1000 ; // 1M
226
+ const size_t k_NUM_ELEMENTS = 1000 * 1000 ; // 1M
227
227
#endif
228
228
229
229
// Insert 1M elements
@@ -275,30 +275,30 @@ static void test4_rinsert()
275
275
bmqtst::TestHelper::printTestName (" RINSERT" );
276
276
277
277
// rinsert() test
278
- typedef bmqc::OrderedHashMap<int , int > MyMapType;
279
- typedef MyMapType::iterator IterType;
280
- typedef MyMapType::const_iterator ConstIterType;
281
- typedef bsl::pair<IterType, bool > RcType;
278
+ typedef bmqc::OrderedHashMap<size_t , size_t > MyMapType;
279
+ typedef MyMapType::iterator IterType;
280
+ typedef MyMapType::const_iterator ConstIterType;
281
+ typedef bsl::pair<IterType, bool > RcType;
282
282
283
283
MyMapType map (bmqtst::TestHelperUtil::allocator ());
284
284
285
285
#if defined(BSLS_PLATFORM_OS_SOLARIS)
286
286
// Avoid timeout on Solaris
287
- const int k_NUM_ELEMENTS = 100 * 1000 ; // 100K
287
+ const size_t k_NUM_ELEMENTS = 100 * 1000 ; // 100K
288
288
#elif defined(__has_feature)
289
289
// Avoid timeout under MemorySanitizer
290
- const int k_NUM_ELEMENTS = __has_feature (memory_sanitizer)
291
- ? 100 * 1000 // 100K
292
- : 1000 * 1000 ; // 1M
290
+ const size_t k_NUM_ELEMENTS = __has_feature (memory_sanitizer)
291
+ ? 100 * 1000 // 100K
292
+ : 1000 * 1000 ; // 1M
293
293
#elif defined(__SANITIZE_MEMORY__)
294
294
// GCC-supported macros for checking MSAN
295
- const int k_NUM_ELEMENTS = 100 * 1000 ; // 100K
295
+ const size_t k_NUM_ELEMENTS = 100 * 1000 ; // 100K
296
296
#else
297
- const int k_NUM_ELEMENTS = 1000 * 1000 ; // 1M
297
+ const size_t k_NUM_ELEMENTS = 1000 * 1000 ; // 1M
298
298
#endif
299
299
300
300
// Insert 1M elements
301
- for (int i = 0 ; i < k_NUM_ELEMENTS; ++i) {
301
+ for (size_t i = 0 ; i < k_NUM_ELEMENTS; ++i) {
302
302
RcType rc = map.rinsert (bsl::make_pair (i, i + 1 ));
303
303
BMQTST_ASSERT_EQ_D (i, true , rc.second );
304
304
BMQTST_ASSERT_EQ_D (i, true , rc.first != map.end ());
@@ -307,12 +307,12 @@ static void test4_rinsert()
307
307
BMQTST_ASSERT_EQ_D (i, true , 1.5 >= map.load_factor ());
308
308
}
309
309
310
- BMQTST_ASSERT_EQ (map.size (), static_cast < size_t >( k_NUM_ELEMENTS) );
310
+ BMQTST_ASSERT_EQ (map.size (), k_NUM_ELEMENTS);
311
311
312
312
// Iterate and confirm
313
313
{
314
314
const MyMapType& cmap = map;
315
- int i = k_NUM_ELEMENTS - 1 ;
315
+ size_t i = k_NUM_ELEMENTS - 1 ;
316
316
for (ConstIterType cit = cmap.begin (); cit != cmap.end (); ++cit) {
317
317
BMQTST_ASSERT_EQ_D (i, i, cit->first );
318
318
BMQTST_ASSERT_EQ_D (i, (i + 1 ), cit->second );
@@ -323,7 +323,7 @@ static void test4_rinsert()
323
323
// Reverse iterate using --(end()) and confirm
324
324
{
325
325
const MyMapType& cmap = map;
326
- int i = 0 ;
326
+ size_t i = 0 ;
327
327
ConstIterType cit = --(cmap.end ()); // last element
328
328
for (; cit != cmap.begin (); --cit) {
329
329
BMQTST_ASSERT_EQ_D (i, true , i < k_NUM_ELEMENTS);
@@ -450,9 +450,9 @@ static void test6_clear()
450
450
bmqtst::TestHelper::printTestName (" CLEAR" );
451
451
452
452
// clear
453
- typedef bmqc::OrderedHashMap<int , int > MyMapType;
454
- typedef MyMapType::iterator IterType;
455
- typedef bsl::pair<IterType, bool > RcType;
453
+ typedef bmqc::OrderedHashMap<size_t , size_t > MyMapType;
454
+ typedef MyMapType::iterator IterType;
455
+ typedef bsl::pair<IterType, bool > RcType;
456
456
457
457
MyMapType map (bmqtst::TestHelperUtil::allocator ());
458
458
BMQTST_ASSERT_EQ (true , map.empty ());
@@ -466,10 +466,10 @@ static void test6_clear()
466
466
BMQTST_ASSERT_EQ (0U , map.size ());
467
467
BMQTST_ASSERT_EQ (true , map.load_factor () == 0.0 );
468
468
469
- const int k_NUM_ELEMENTS = 100 ;
469
+ const size_t k_NUM_ELEMENTS = 100 ;
470
470
471
471
// Insert elements
472
- for (int i = 0 ; i < k_NUM_ELEMENTS; ++i) {
472
+ for (size_t i = 0 ; i < k_NUM_ELEMENTS; ++i) {
473
473
RcType rc = map.insert (bsl::make_pair (i, i + 1 ));
474
474
BMQTST_ASSERT_EQ_D (i, rc.second , true );
475
475
BMQTST_ASSERT_EQ_D (i, true , rc.first != map.end ());
@@ -479,7 +479,7 @@ static void test6_clear()
479
479
480
480
BMQTST_ASSERT_EQ (false , map.empty ());
481
481
BMQTST_ASSERT_EQ (true , map.begin () != map.end ());
482
- BMQTST_ASSERT_EQ (static_cast < int >( k_NUM_ELEMENTS) , map.size ());
482
+ BMQTST_ASSERT_EQ (k_NUM_ELEMENTS, map.size ());
483
483
484
484
map.clear ();
485
485
BMQTST_ASSERT_EQ (true , map.empty ());
@@ -496,16 +496,16 @@ static void test7_erase()
496
496
bmqtst::TestHelper::printTestName (" ERASE" );
497
497
498
498
// erase
499
- typedef bmqc::OrderedHashMap<int , int > MyMapType;
500
- typedef MyMapType::iterator IterType;
501
- typedef MyMapType::const_iterator ConstIterType;
502
- typedef bsl::pair<IterType, bool > RcType;
499
+ typedef bmqc::OrderedHashMap<size_t , size_t > MyMapType;
500
+ typedef MyMapType::iterator IterType;
501
+ typedef MyMapType::const_iterator ConstIterType;
502
+ typedef bsl::pair<IterType, bool > RcType;
503
503
504
- const int k_NUM_ELEMENTS = 100 ;
505
- MyMapType map (bmqtst::TestHelperUtil::allocator ());
504
+ const size_t k_NUM_ELEMENTS = 100 ;
505
+ MyMapType map (bmqtst::TestHelperUtil::allocator ());
506
506
507
507
// Insert elements
508
- for (int i = 0 ; i < k_NUM_ELEMENTS; ++i) {
508
+ for (size_t i = 0 ; i < k_NUM_ELEMENTS; ++i) {
509
509
RcType rc = map.insert (bsl::make_pair (i, i));
510
510
BMQTST_ASSERT_EQ_D (i, rc.second , true );
511
511
BMQTST_ASSERT_EQ_D (i, true , rc.first != map.end ());
@@ -767,9 +767,9 @@ static void test13_previousEndIterator()
767
767
bmqtst::TestHelper::printTestName (" PREVIOUS END ITERATOR" );
768
768
// is pointing to the newly inserted element.
769
769
770
- typedef bmqc::OrderedHashMap<int , int > MyMapType;
771
- typedef MyMapType::iterator IterType;
772
- typedef MyMapType::const_iterator ConstIterType;
770
+ typedef bmqc::OrderedHashMap<size_t , size_t > MyMapType;
771
+ typedef MyMapType::iterator IterType;
772
+ typedef MyMapType::const_iterator ConstIterType;
773
773
774
774
MyMapType map (bmqtst::TestHelperUtil::allocator ());
775
775
const MyMapType& cmap = map;
@@ -780,7 +780,7 @@ static void test13_previousEndIterator()
780
780
IterType endIt = map.end ();
781
781
ConstIterType endCit = cmap.end ();
782
782
783
- int i = 0 ;
783
+ size_t i = 0 ;
784
784
bsl::pair<IterType, bool > rc = map.insert (bsl::make_pair (i, i * i));
785
785
786
786
BMQTST_ASSERT_EQ (true , rc.first == endIt);
@@ -954,8 +954,7 @@ static void test15_eraseRange()
954
954
BMQTST_ASSERT_EQ (true , map.empty ());
955
955
}
956
956
957
- BSLA_MAYBE_UNUSED
958
- static void testN1_insertPerformanceOrdered ()
957
+ BSLA_MAYBE_UNUSED static void testN1_insertPerformanceOrdered ()
959
958
// ------------------------------------------------------------------------
960
959
// INSERT PERFORMANCE
961
960
// ------------------------------------------------------------------------
@@ -982,8 +981,7 @@ static void testN1_insertPerformanceOrdered()
982
981
}
983
982
}
984
983
985
- BSLA_MAYBE_UNUSED
986
- static void testN1_insertPerformanceUnordered ()
984
+ BSLA_MAYBE_UNUSED static void testN1_insertPerformanceUnordered ()
987
985
// ------------------------------------------------------------------------
988
986
// INSERT PERFORMANCE
989
987
// ------------------------------------------------------------------------
0 commit comments