2216
2216
\tcode {z} denotes a value of type \tcode {float},
2217
2217
and \tcode {nh} denotes a non-const rvalue of type \tcode {X::node_type}.
2218
2218
2219
+ % Local command to index names as members of all unordered containers.
2220
+ \newcommand {\indexunordmem }[1]{%
2221
+ \indexlibrary {\idxcode {#1}!unordered associative containers}%
2222
+ \indexlibrary {\idxcode {unordered_set}!\idxcode {#1}}%
2223
+ \indexlibrary {\idxcode {unordered_map}!\idxcode {#1}}%
2224
+ \indexlibrary {\idxcode {unordered_multiset}!\idxcode {#1}}%
2225
+ \indexlibrary {\idxcode {unordered_multimap}!\idxcode {#1}}%
2226
+ }
2227
+
2219
2228
\begin {libreqtab4d }
2220
2229
{Unordered associative container requirements (in addition to container)}
2221
2230
{tab:HashRequirements}
2229
2238
& & \chdr {pre-/post-condition} & \\ \capsep
2230
2239
\endhead
2231
2240
% %
2241
+ \indexunordmem {key_type}%
2232
2242
\tcode {X::key_type} &
2233
- \indextext {unordered associative containers!\idxcode {key_type}}%
2234
- \indextext {\idxcode {key_type}!unordered associative containers}%
2235
2243
\tcode {Key} &
2236
2244
&
2237
2245
compile time \\ \rowsep
2251
2259
\requires \ \tcode {value_type} is \tcode {Erasable} from \tcode {X} &
2252
2260
compile time \\ \rowsep
2253
2261
2262
+ \indexunordmem {hasher}%
2254
2263
\tcode {X::hasher}
2255
2264
& \tcode {Hash}
2256
2265
& \tcode {Hash} shall be a unary function object type such that the expression
2257
2266
\tcode {hf(k)} has type \tcode {size_t}.%
2258
- \indextext {unordered associative containers!\idxcode {hasher}}%
2259
- \indextext {\idxcode {hasher}!unordered associative containers}%
2260
2267
& compile time
2261
2268
\\ \rowsep
2262
2269
%
2270
+ \indexunordmem {key_equal}%
2263
2271
\tcode {X::key_equal}
2264
2272
& \tcode {Pred}
2265
2273
& \requires \ \tcode {Pred} is \tcode {CopyConstructible}.\br
2266
2274
\tcode {Pred} shall be a binary predicate that takes two arguments
2267
2275
of type \tcode {Key}. \tcode {Pred} is an equivalence relation.%
2268
- \indextext {unordered associative containers!\idxcode {key_equal}}%
2269
- \indextext {\idxcode {key_equal}!unordered associative containers}%
2270
2276
& compile time
2271
2277
\\ \rowsep
2272
2278
%
2279
+ \indexunordmem {local_iterator}%
2273
2280
\tcode {X::local_iterator}
2274
2281
& An iterator type whose category, value type,
2275
2282
difference type, and pointer and reference types are the same as
2276
2283
\tcode {X::iterator}'s. \indextext {\idxcode {local_iterator}}
2277
2284
& A \tcode {local_iterator} object may be used to iterate through a
2278
2285
single bucket, but may not be used to iterate across
2279
2286
buckets.%
2280
- \indextext {unordered associative containers!\idxcode {local_iterator}}%
2281
- \indextext {\idxcode {local_iterator}!unordered associative containers}%
2282
2287
& compile time
2283
2288
\\ \rowsep
2284
2289
%
2290
+ \indexunordmem {const_local_iterator}%
2285
2291
\tcode {X::const_local_iterator}
2286
2292
& An iterator type whose category, value type,
2287
2293
difference type, and pointer and reference types are the same as
2288
2294
\tcode {X::const_iterator}'s. \indextext {\idxcode {const_local_iterator}}
2289
2295
& A \tcode {const_local_iterator} object may be used to iterate through a
2290
2296
single bucket, but may not be used to iterate across
2291
2297
buckets.%
2292
- \indextext {unordered associative containers!\idxcode {const_local_iterator}}%
2293
- \indextext {\idxcode {const_local_iterator}!unordered associative containers}%
2294
2298
& compile time
2295
2299
\\ \rowsep
2296
2300
%
2301
+ \indexunordmem {node_type}%
2297
2302
\tcode {X::node_type} &
2298
2303
a specialization of a \tcode {\placeholder {node_handle}}
2299
2304
class template, such that the public nested types are
2431
2436
& Same as \tcode {a = X(il)}.
2432
2437
\\ \rowsep
2433
2438
%
2439
+ \indexunordmem {hash_function}%
2434
2440
\tcode {b.hash_function()}
2435
2441
& \tcode {hasher}
2436
2442
& Returns \tcode {b}'s hash function.%
2437
- \indextext {unordered associative containers!\idxcode {hash_function}}%
2438
- \indextext {\idxcode {hash_function}!unordered associative containers}%
2439
2443
& constant
2440
2444
\\ \rowsep
2441
2445
%
2446
+ \indexunordmem {key_eq}%
2442
2447
\tcode {b.key_eq()}
2443
2448
& \tcode {key_equal}
2444
2449
& Returns \tcode {b}'s key equality predicate.%
2445
- \indextext {unordered associative containers!\idxcode {key_eq}}%
2446
- \indextext {\idxcode {key_eq}!unordered associative containers}%
2447
2450
& constant
2448
2451
\\ \rowsep
2449
2452
%
2481
2484
Average case \bigoh {1}, worst case \bigoh {\tcode {a.} \tcode {size()}}.
2482
2485
\\ \rowsep
2483
2486
2487
+ \indexunordmem {insert}%
2484
2488
\tcode {a_uniq.insert(t)}
2485
2489
& \tcode {pair<iterator, bool>}
2486
2490
& \requires \ If \tcode {t} is a non-const rvalue expression, \tcode {value_type} shall be
2491
2495
component of the returned pair indicates whether the insertion
2492
2496
takes place, and the \tcode {iterator} component points to the element
2493
2497
with key equivalent to the key of \tcode {t}.%
2494
- \indextext {unordered associative containers!\idxcode {insert}}%
2495
- \indextext {\idxcode {insert}!unordered associative containers}%
2496
2498
& Average case \bigoh {1}, worst case \bigoh {\tcode {a_uniq.}\br\tcode {size()}}.
2497
2499
\\ \rowsep
2498
2500
%
2503
2505
\tcode {CopyInsertable} into \tcode {X}.\br
2504
2506
\effects \ Inserts \tcode {t}, and returns an iterator pointing to the newly
2505
2507
inserted element.
2506
- \indextext {unordered associative containers!\idxcode {insert}}%
2507
- \indextext {\idxcode {insert}!unordered associative containers}%
2508
2508
& Average case \bigoh {1}, worst case \bigoh {\tcode {a_eq.}\br\tcode {size()}}.
2509
2509
\\ \rowsep
2510
2510
%
2517
2517
to the element with the key equivalent to that of \tcode {t}. The
2518
2518
iterator \tcode {p} is a hint pointing to where the search should
2519
2519
start. Implementations are permitted to ignore the hint.%
2520
- \indextext {unordered associative containers!\idxcode {insert}}%
2521
- \indextext {\idxcode {insert}!unordered associative containers}%
2522
2520
& Average case \bigoh {1}, worst case \bigoh {\tcode {a.size()}}.
2523
2521
\\ \rowsep
2524
2522
%
2527
2525
& \requires \ \tcode {value_type} shall be \tcode {EmplaceConstructible} into \tcode {X} from \tcode {*i}.\br
2528
2526
\requires \tcode {i} and \tcode {j} are not iterators in \tcode {a}.\br
2529
2527
\effects Equivalent to \tcode {a.insert(t)} for each element in \tcode {[i,j)}.%
2530
- \indextext {unordered associative containers!\idxcode {insert}}%
2531
- \indextext {\idxcode {insert}!unordered associative containers}%
2532
2528
& Average case \bigoh {N}, where $ N$ is \tcode {distance(i, j)}.
2533
2529
Worst case \bigoh {N(\tcode {a.size()}\brk {}+\brk {}1)}.
2534
2530
\\ \rowsep
2619
2615
\bigoh {\tcode {a.size()}}.
2620
2616
\\ \rowsep
2621
2617
%
2618
+ \indexunordmem {erase}%
2622
2619
\tcode {a.erase(q)}
2623
2620
& \tcode {iterator}
2624
2621
& Erases the element pointed to by \tcode {q}. Returns the
2625
2622
iterator immediately following \tcode {q} prior to the erasure.
2626
- \indextext {unordered associative containers!\idxcode {erase}}%
2627
- \indextext {\idxcode {erase}!unordered associative containers}%
2628
2623
& Average case \bigoh {1}, worst case \bigoh {\tcode {a.size()}}.
2629
2624
\\ \rowsep
2630
2625
%
2631
2626
\tcode {a.erase(r)}
2632
2627
& \tcode {iterator}
2633
2628
& Erases the element pointed to by \tcode {r}. Returns the
2634
2629
iterator immediately following \tcode {r} prior to the erasure.
2635
- \indextext {unordered associative containers!\idxcode {erase}}%
2636
- \indextext {\idxcode {erase}!unordered associative containers}%
2637
2630
& Average case \bigoh {1}, worst case \bigoh {\tcode {a.size()}}.
2638
2631
\\ \rowsep
2639
2632
%
@@ -2642,148 +2635,132 @@
2642
2635
& Erases all elements in the range \tcode {[q1, q2)}. Returns
2643
2636
the iterator immediately following the erased elements prior to the
2644
2637
erasure.%
2645
- \indextext {unordered associative containers!\idxcode {erase}}%
2646
- \indextext {\idxcode {erase}!unordered associative containers}%
2647
2638
& Average case linear in \tcode {distance(q1, q2)},
2648
2639
worst case \bigoh {\tcode {a.size()}}.
2649
2640
\\ \rowsep
2650
2641
%
2642
+ \indexunordmem {clear}%
2651
2643
\tcode {a.clear()}
2652
2644
& \tcode {void}
2653
2645
& Erases all elements in the container.
2654
2646
\postconditions \tcode {a.empty()} returns \tcode {true}%
2655
- \indextext {unordered associative containers!\idxcode {clear}}%
2656
- \indextext {\idxcode {clear}!unordered associative containers}%
2657
2647
& Linear in \tcode {a.size()}.
2658
2648
\\ \rowsep
2659
2649
%
2650
+ \indexunordmem {find}%
2660
2651
\tcode {b.find(k)}
2661
2652
& \tcode {iterator}; \br \tcode {const_iterator} for const \tcode {b}.
2662
2653
& Returns an iterator pointing to an element with key equivalent to
2663
2654
\tcode {k}, or \tcode {b.end()} if no such element exists.%
2664
- \indextext {unordered associative containers!\idxcode {find}}%
2665
- \indextext {\idxcode {find}!unordered associative containers}%
2666
2655
& Average case \bigoh {1}, worst case \bigoh {\tcode {b.size()}}.
2667
2656
\\ \rowsep
2668
2657
%
2658
+ \indexunordmem {count}%
2669
2659
\tcode {b.count(k)}
2670
2660
& \tcode {size_type}
2671
2661
& Returns the number of elements with key equivalent to \tcode {k}.%
2672
- \indextext {unordered associative containers!\idxcode {count}}%
2673
- \indextext {\idxcode {count}!unordered associative containers}%
2674
2662
& Average case \bigoh {\tcode {b.count(k)}}, worst case \bigoh {\tcode {b.size()}}.
2675
2663
\\ \rowsep
2676
2664
%
2665
+ \indexunordmem {equal_range}%
2677
2666
\tcode {b.equal_range(k)}
2678
2667
& \tcode {pair<iterator, iterator>}; \br
2679
2668
\tcode {pair<const_iterator, const_iterator>} for const \tcode {b}.
2680
2669
& Returns a range containing all elements with keys equivalent to
2681
2670
\tcode {k}. Returns \tcode {make_pair(b.end(), b.end())} if
2682
2671
no such elements exist.%
2683
- \indextext {unordered associative containers!\idxcode {equal_range}}%
2684
- \indextext {\idxcode {equal_range}!unordered associative containers}%
2685
2672
& Average case \bigoh {\tcode {b.count(k)}}. Worst case
2686
2673
\bigoh {\tcode {b.size()}}.
2687
2674
\\ \rowsep
2688
2675
%
2676
+ \indexunordmem {bucket_count}%
2689
2677
\tcode {b.bucket_count()}
2690
2678
& \tcode {size_type}
2691
2679
& Returns the number of buckets that \tcode {b} contains.%
2692
- \indextext {unordered associative containers!\idxcode {bucket_count}}%
2693
- \indextext {\idxcode {bucket_count}!unordered associative containers}%
2694
2680
& Constant
2695
2681
\\ \rowsep
2696
2682
%
2683
+ \indexunordmem {max_bucket_count}%
2697
2684
\tcode {b.max_bucket_count()}
2698
2685
& \tcode {size_type}
2699
2686
& Returns an upper bound on the number of buckets that \tcode {b} might
2700
2687
ever contain.%
2701
- \indextext {unordered associative containers!\idxcode {max_bucket_count}}%
2702
- \indextext {\idxcode {max_bucket_count}!unordered associative containers}%
2703
2688
& Constant
2704
2689
\\ \rowsep
2705
2690
%
2691
+ \indexunordmem {bucket}%
2706
2692
\tcode {b.bucket(k)}
2707
2693
& \tcode {size_type}
2708
2694
&
2709
2695
\requires \tcode {b.bucket_count() > 0}.\br
2710
2696
Returns the index of the bucket in which elements with keys equivalent
2711
2697
to \tcode {k} would be found, if any such element existed.
2712
2698
\postconditions the return value shall be in the range \tcode {[0, b.bucket_count())}.%
2713
- \indextext {unordered associative containers!\idxcode {bucket}}%
2714
- \indextext {\idxcode {bucket}!unordered associative containers}%
2715
2699
& Constant
2716
2700
\\ \rowsep
2717
2701
%
2702
+ \indexunordmem {bucket_size}%
2718
2703
\tcode {b.bucket_size(n)}
2719
2704
& \tcode {size_type}
2720
2705
& \requires \tcode {n} shall be in the range \tcode {[0, b.bucket_count())}.
2721
2706
Returns the number of elements in the $ \texttt {n}^{\textrm { th}}$ bucket.%
2722
- \indextext {unordered associative containers!\idxcode {bucket_size}}%
2723
- \indextext {\idxcode {bucket_size}!unordered associative containers}%
2724
2707
& \bigoh {\tcode {b.bucket_}\- \tcode {size(n)}}
2725
2708
\\ \rowsep
2726
2709
%
2710
+ \indexunordmem {begin}%
2727
2711
\tcode {b.begin(n)}
2728
2712
& \tcode {local_iterator}; \br
2729
2713
\tcode {const_local_iterator} for const \tcode {b}.
2730
2714
& \requires \tcode {n} shall be in the range \tcode {[0, b.bucket_count())}.
2731
2715
\tcode {b.begin(n)} returns an iterator referring to the
2732
2716
first element in the bucket. If the bucket is empty, then
2733
2717
\tcode {b.begin(n) == b.end(n)}.%
2734
- \indextext {unordered associative containers!\idxcode {begin}}%
2735
- \indextext {\idxcode {begin}!unordered associative containers}%
2736
2718
& Constant
2737
2719
\\ \rowsep
2738
2720
%
2721
+ \indexunordmem {end}%
2739
2722
\tcode {b.end(n)}
2740
2723
& \tcode {local_iterator}; \br
2741
2724
\tcode {const_local_iterator} for const \tcode {b}.
2742
2725
& \requires \tcode {n} shall be in the range \tcode {[0, b.bucket_count())}.
2743
2726
\tcode {b.end(n)} returns an iterator which is the past-the-end
2744
2727
value for the bucket.%
2745
- \indextext {unordered associative containers!\idxcode {end}}%
2746
- \indextext {\idxcode {end}!unordered associative containers}%
2747
2728
& Constant
2748
2729
\\ \rowsep
2749
2730
%
2731
+ \indexunordmem {cbegin}%
2750
2732
\tcode {b.cbegin(n)}
2751
2733
& \tcode {const_local_iterator}
2752
2734
& \requires \tcode {n} shall be in the range \tcode {[0, b.bucket_count())}.
2753
2735
\tcode {b.cbegin(n)} returns an iterator referring to the
2754
2736
first element in the bucket. If the bucket is empty, then
2755
2737
\tcode {b.cbegin(n) == b.cend(n)}.%
2756
- \indextext {unordered associative containers!\idxcode {cbegin}}%
2757
- \indextext {\idxcode {cbegin}!unordered associative containers}%
2758
2738
& Constant
2759
2739
\\ \rowsep
2760
2740
%
2741
+ \indexunordmem {cend}%
2761
2742
\tcode {b.cend(n)}
2762
2743
& \tcode {const_local_iterator}
2763
2744
& \requires \tcode {n} shall be in the range \tcode {[0, b.bucket_count())}.%
2764
2745
\tcode {b.cend(n)} returns an iterator which is the past-the-end
2765
2746
value for the bucket.%
2766
- \indextext {unordered associative containers!\idxcode {cend}}%
2767
- \indextext {\idxcode {cend}!unordered associative containers}%
2768
2747
& Constant
2769
2748
\\ \rowsep
2770
2749
%
2750
+ \indexunordmem {load_factor}%
2771
2751
\tcode {b.load_factor()}
2772
2752
& \tcode {float}
2773
2753
& Returns the average number of elements per bucket.%
2774
- \indextext {unordered associative containers!\idxcode {load_factor}}%
2775
- \indextext {\idxcode {load_factor}!unordered associative containers}%
2776
2754
& Constant
2777
2755
\\ \rowsep
2778
2756
%
2757
+ \indexunordmem {max_load_factor}%
2779
2758
\tcode {b.max_load_factor()}
2780
2759
& \tcode {float}
2781
2760
& Returns a positive number that the container attempts to keep the load factor
2782
2761
less than or equal to. The container automatically increases the
2783
2762
number of buckets as necessary to keep the load factor below this
2784
2763
number.%
2785
- \indextext {unordered associative containers!\idxcode {max_load_factor}}%
2786
- \indextext {\idxcode {max_load_factor}!unordered associative containers}%
2787
2764
& Constant
2788
2765
\\ \rowsep
2789
2766
%
2794
2771
& Constant
2795
2772
\\ \rowsep
2796
2773
%
2774
+ \indexunordmem {rehash}%
2797
2775
\tcode {a.rehash(n)}
2798
2776
& \tcode {void}
2799
2777
& \postconditions \tcode {a.bucket_count() >= a.size() / a.max_load_factor()} and
2800
2778
\tcode {a.bucket_count() >= n}.%
2801
- \indextext {unordered associative containers!\idxcode {rehash}}%
2802
- \indextext {\idxcode {rehash}!unordered associative containers}%
2803
2779
& Average case linear in \tcode {a.size()}, worst case quadratic.
2804
2780
\\ \rowsep
2805
2781
2782
+ \indexunordmem {reserve}%
2806
2783
\tcode {a.reserve(n)} &
2807
2784
\tcode {void} &
2808
2785
Same as \tcode {a.rehash(ceil(n /} \tcode {a.max_load_factor()))}. &
0 commit comments