File: iter-issue-list.html

package info (click to toggle)
boost 1.32.0-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 93,952 kB
  • ctags: 128,458
  • sloc: cpp: 492,477; xml: 52,125; python: 13,519; ansic: 13,013; sh: 1,773; yacc: 853; makefile: 526; perl: 418; lex: 110; csh: 6
file content (5268 lines) | stat: -rw-r--r-- 250,342 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
<title>Iterator concept and adapter issues</title>
<meta name="date" content="2004-01-27" />
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body>
<h1 class="title">Iterator concept and adapter issues</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Date:</th>
<td>2004-01-27</td></tr>
</tbody>
</table>
<div class="document" id="iterator-concept-and-adapter-issues">
<div class="contents topic" id="index">
<p class="topic-title first"><a name="index">Index</a></p>
<ul class="simple">
<li><a class="reference" href="#issues-from-matt-s-tr-issues-list" id="id1" name="id1">Issues from Matt's TR issues list</a><ul>
<li><a class="reference" href="#iterator-access-overspecified" id="id2" name="id2">9.1 iterator_access overspecified?</a></li>
<li><a class="reference" href="#operators-of-iterator-facade-overspecified" id="id3" name="id3">9.2 operators of iterator_facade overspecified</a></li>
<li><a class="reference" href="#enable-if-interoperable-needs-standardese" id="id4" name="id4">9.3 enable_if_interoperable needs standardese</a></li>
<li><a class="reference" href="#enable-if-convertible-unspecified-conflicts-with-requires" id="id5" name="id5">9.4 enable_if_convertible unspecified, conflicts with requires</a></li>
<li><a class="reference" href="#iterator-adaptor-has-an-extraneous-bool-at-the-start-of-the-template-definition" id="id6" name="id6">9.5 iterator_adaptor has an extraneous 'bool' at the start of the template definition</a></li>
<li><a class="reference" href="#name-of-private-member-shouldn-t-be-normative" id="id7" name="id7">9.6 Name of private member shouldn't be normative</a></li>
<li><a class="reference" href="#iterator-adaptor-operations-specifications-are-a-bit-inconsistent" id="id8" name="id8">9.7 iterator_adaptor operations specifications are a bit inconsistent</a></li>
<li><a class="reference" href="#specialized-adaptors-text-should-be-normative" id="id9" name="id9">9.8 Specialized adaptors text should be normative</a></li>
<li><a class="reference" href="#reverse-iterator-text-is-too-informal" id="id10" name="id10">9.9 Reverse_iterator text is too informal</a></li>
<li><a class="reference" href="#prior-is-undefined" id="id11" name="id11">9.10 'prior' is undefined</a></li>
<li><a class="reference" href="#in-other-words-is-bad-wording" id="id12" name="id12">9.11 &quot;In other words&quot; is bad wording</a></li>
<li><a class="reference" href="#transform-iterator-shouldn-t-mandate-private-member" id="id13" name="id13">9.12 Transform_iterator shouldn't mandate private member</a></li>
<li><a class="reference" href="#unclear-description-of-counting-iterator" id="id14" name="id14">9.13 Unclear description of counting iterator</a></li>
<li><a class="reference" href="#counting-iterator-s-difference-type" id="id15" name="id15">9.14 Counting_iterator's difference type</a></li>
<li><a class="reference" href="#how-to-detect-lvalueness" id="id16" name="id16">9.15 How to detect lvalueness?</a></li>
<li><a class="reference" href="#is-writable-iterator-returns-false-positives" id="id17" name="id17">9.16 is_writable_iterator returns false positives</a></li>
<li><a class="reference" href="#is-swappable-iterator-returns-false-positives" id="id18" name="id18">9.17 is_swappable_iterator returns false positives</a></li>
<li><a class="reference" href="#are-is-readable-is-writable-and-is-swappable-useful" id="id19" name="id19">9.18 Are is_readable, is_writable, and is_swappable useful?</a></li>
<li><a class="reference" href="#non-uniformity-of-the-lvalue-iterator-bit" id="id20" name="id20">9.19 Non-Uniformity of the &quot;lvalue_iterator Bit&quot;</a></li>
<li><a class="reference" href="#traversal-concepts-and-tags" id="id21" name="id21">9.20 Traversal Concepts and Tags</a></li>
<li><a class="reference" href="#iterator-facade-derived-template-argument-underspecified" id="id22" name="id22">9.21 iterator_facade Derived template argument underspecified</a></li>
<li><a class="reference" href="#return-type-of-iterator-difference-for-iterator-facade" id="id23" name="id23">9.22 return type of Iterator difference for iterator facade</a></li>
<li><a class="reference" href="#iterator-facade-minor-wording-issue" id="id24" name="id24">9.23 Iterator_facade: minor wording Issue</a></li>
<li><a class="reference" href="#use-of-undefined-name-in-iterator-facade-table" id="id25" name="id25">9.24 Use of undefined name in iterator_facade table</a></li>
<li><a class="reference" href="#iterator-facade-wrong-return-type" id="id26" name="id26">9.25 Iterator_facade: wrong return type</a></li>
<li><a class="reference" href="#iterator-facade-unclear-returns-clause-for-operator" id="id27" name="id27">9.26 Iterator_facade: unclear returns clause for operator[]</a></li>
<li><a class="reference" href="#iterator-facade-redundant-clause" id="id28" name="id28">9.27 Iterator_facade: redundant clause</a></li>
<li><a class="reference" href="#indirect-iterator-incorrect-specification-of-default-constructor" id="id29" name="id29">9.28 indirect_iterator: incorrect specification of default constructor</a></li>
<li><a class="reference" href="#indirect-iterator-unclear-specification-of-template-constructor" id="id30" name="id30">9.29 indirect_iterator: unclear specification of template constructor</a></li>
<li><a class="reference" href="#transform-iterator-argument-irregularity" id="id31" name="id31">9.30 transform_iterator argument irregularity</a></li>
<li><a class="reference" href="#function-output-iterator-overconstrained" id="id32" name="id32">9.31 function_output_iterator overconstrained</a></li>
<li><a class="reference" href="#should-output-proxy-really-be-a-named-type" id="id33" name="id33">9.32 Should output_proxy really be a named type?</a></li>
<li><a class="reference" href="#istreambuf-iterator-isn-t-a-readable-iterator" id="id34" name="id34">9.33 istreambuf_iterator isn't a Readable Iterator</a></li>
<li><a class="reference" href="#iterator-facade-free-functions-unspecified" id="id35" name="id35">9.34 iterator_facade free functions unspecified</a></li>
<li><a class="reference" href="#iterator-facade-too-many-equals" id="id36" name="id36">9.35 iterator_facade: too many equals?</a></li>
<li><a class="reference" href="#iterator-facade-function-requirements" id="id37" name="id37">9.36 iterator_facade function requirements</a></li>
</ul>
</li>
<li><a class="reference" href="#more-issues-not-from-matt-s-list" id="id38" name="id38">More Issues (not from Matt's list)</a><ul>
<li><a class="reference" href="#x-inheritance-in-iterator-adaptor-and-other-adaptors-is-an-overspecification" id="id39" name="id39">9.37x Inheritance in iterator_adaptor and other adaptors is an overspecification</a></li>
<li><a class="reference" href="#x-problem-with-specification-of-a-m-in-readable-iterator" id="id40" name="id40">9.38x Problem with specification of a-&gt;m in Readable Iterator</a></li>
<li><a class="reference" href="#x-counting-iterator-traversal-argument-unspecified" id="id41" name="id41">9.39x counting_iterator Traversal argument unspecified</a></li>
<li><a class="reference" href="#x-indirect-iterator-requirements-muddled" id="id42" name="id42">9.40x indirect_iterator requirements muddled</a></li>
<li><a class="reference" href="#x-problem-with-transform-iterator-requirements" id="id43" name="id43">9.41x Problem with transform_iterator requirements</a></li>
<li><a class="reference" href="#x-filter-iterator-details-unspecified" id="id44" name="id44">9.42x filter_iterator details unspecified</a></li>
<li><a class="reference" href="#x-transform-iterator-interoperability-too-restrictive" id="id45" name="id45">9.43x transform_iterator interoperability too restrictive</a></li>
<li><a class="reference" href="#y-indirect-iterator-and-smart-pointers" id="id46" name="id46">9.44y <tt class="literal"><span class="pre">indirect_iterator</span></tt> and smart pointers</a></li>
<li><a class="reference" href="#y-n1530-typos-and-editorial-changes-in-proposal-text-not-standardese" id="id47" name="id47">9.45y N1530: Typos and editorial changes in proposal text (not standardese)</a></li>
<li><a class="reference" href="#y-n1530-base-return-by-value-is-costly" id="id48" name="id48">9.46y N1530: <tt class="literal"><span class="pre">base()</span></tt> return-by-value is costly</a></li>
<li><a class="reference" href="#x-forgot-default-constructible-in-forward-traversal-iterator" id="id49" name="id49">9.47x Forgot default constructible in Forward Traversal Iterator</a></li>
<li><a class="reference" href="#x-editorial-changes-non-normative-text" id="id50" name="id50">9.48x Editorial changes (non-normative text)</a></li>
<li><a class="reference" href="#x-clarification-of-iterator-facade-requirements-and-type-members" id="id51" name="id51">9.49x Clarification of iterator_facade requirements and type members</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="issues-from-matt-s-tr-issues-list">
<h1><a class="toc-backref" href="#id1" name="issues-from-matt-s-tr-issues-list">Issues from Matt's TR issues list</a></h1>
<div class="section" id="iterator-access-overspecified">
<h2><a class="toc-backref" href="#id2" name="iterator-access-overspecified">9.1 iterator_access overspecified?</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The proposal includes:</p>
<pre class="literal-block">
enum iterator_access { 
   readable_iterator = 1, writable_iterator = 2,
   swappable_iterator = 4, lvalue_iterator = 8
}; 
</pre>
<p>In general, the standard specifies thing like this as a bitmask
type with a list of defined names, and specifies neither the exact
type nor the specific values. Is there a reason for iterator_access
to be more specific?</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">The <tt class="literal"><span class="pre">iterator_access</span></tt> enum will be removed,
so this is no longer an issue.  See the resolution to 9.15.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="operators-of-iterator-facade-overspecified">
<h2><a class="toc-backref" href="#id3" name="operators-of-iterator-facade-overspecified">9.2 operators of iterator_facade overspecified</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>In general, we've provided operational semantics for things like
operator++. That is, we've said that ++iter must work, without
requiring either a member function or a non-member function.
iterator_facade specifies most operators as member
functions. There's no inherent reason for these to be members, so
we should remove this requirement. Similarly, some operations are
specified as non-member functions but could be implemented as
members. Again, the standard doesn't make either of these choices,
and TR1 shouldn't, either. So: <tt class="literal"><span class="pre">operator*()</span></tt>, <tt class="literal"><span class="pre">operator++()</span></tt>,
<tt class="literal"><span class="pre">operator++(int)</span></tt>, <tt class="literal"><span class="pre">operator--()</span></tt>, <tt class="literal"><span class="pre">operator--(int)</span></tt>,
<tt class="literal"><span class="pre">operator+=</span></tt>, <tt class="literal"><span class="pre">operator-=</span></tt>, <tt class="literal"><span class="pre">operator-(difference_type)</span></tt>,
<tt class="literal"><span class="pre">operator-(iterator_facade</span> <span class="pre">instance)</span></tt>, and <tt class="literal"><span class="pre">operator+</span></tt> should
be specified with operational semantics and not explicitly required
to be members or non-members.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Not a defect.</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">The standard uses valid expressions such as <tt class="literal"><span class="pre">++iter</span></tt>
in requirements tables, such as for input iterator.  However, for
classes, such as <tt class="literal"><span class="pre">reverse_iterator</span></tt>, the standard uses function
prototypes, as we have done here for
<tt class="literal"><span class="pre">iterator_facade</span></tt>. Further, the prototype specification does
not prevent the implementor from using members or non-members,
since nothing the user can do in a conforming program can detect
how the function is implemented.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="enable-if-interoperable-needs-standardese">
<h2><a class="toc-backref" href="#id4" name="enable-if-interoperable-needs-standardese">9.3 enable_if_interoperable needs standardese</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The only discussion of what this means is in a note, so is
non-normative. Further, the note seems to be incorrect. It says
that enable_if_interoperable only works for types that &quot;are
interoperable, by which we mean they are convertible to each
other.&quot; This requirement is too strong: it should be that one of
the types is convertible to the other.  N1541 48</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Add normative text. Relax requirements in the
proposed way.</p>
<p>Change:</p>
<blockquote>
[<em>Note:</em> The <tt class="literal"><span class="pre">enable_if_interoperable</span></tt> template used above is
for exposition purposes. The member operators should be only be
in an overload set provided the derived types <tt class="literal"><span class="pre">Dr1</span></tt> and
<tt class="literal"><span class="pre">Dr2</span></tt> are interoperable, by which we mean they are
convertible to each other.  The <tt class="literal"><span class="pre">enable_if_interoperable</span></tt>
approach uses SFINAE to take the operators out of the overload
set when the types are not interoperable.]</blockquote>
<p>To:</p>
<blockquote class="last">
<p>The <tt class="literal"><span class="pre">enable_if_interoperable</span></tt> template used above is for
exposition purposes.  The member operators should only be in an
overload set provided the derived types <tt class="literal"><span class="pre">Dr1</span></tt> and <tt class="literal"><span class="pre">Dr2</span></tt> are
interoperable, meaning that at least one of the types is
convertible to the other.  The <tt class="literal"><span class="pre">enable_if_interoperable</span></tt>
approach uses SFINAE to take the operators out of the overload
set when the types are not interoperable.  The operators should
behave <em>as-if</em> <tt class="literal"><span class="pre">enable_if_interoperable</span></tt> were defined to be:</p>
<pre class="literal-block">
template &lt;bool, typename&gt; enable_if_interoperable_impl
{};

template &lt;typename T&gt; enable_if_interoperable_impl&lt;true,T&gt;
{ typedef T type; };

template&lt;typename Dr1, typename Dr2, typename T&gt;
struct enable_if_interoperable
  : enable_if_interoperable_impl&lt;
        is_convertible&lt;Dr1,Dr2&gt;::value || is_convertible&lt;Dr2,Dr1&gt;::value
      , T
    &gt;
{};
</pre>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="enable-if-convertible-unspecified-conflicts-with-requires">
<h2><a class="toc-backref" href="#id5" name="enable-if-convertible-unspecified-conflicts-with-requires">9.4 enable_if_convertible unspecified, conflicts with requires</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>In every place where enable_if_convertible is used it's used like
this (simplified):</p>
<pre class="literal-block">
template&lt;class T&gt;
struct C
{
  template&lt;class T1&gt;
  C(T1, enable_if_convertible&lt;T1, T&gt;::type* = 0);
};
</pre>
<p>The idea being that this constructor won't compile if T1 isn't
convertible to T. As a result, the constructor won't be considered
as a possible overload when constructing from an object x where the
type of x isn't convertible to T. In addition, however, each of
these constructors has a requires clause that requires
convertibility, so the behavior of a program that attempts such a
construction is undefined. Seems like the enable_if_convertible
part is irrelevant, and should be removed.  There are two
problems. First, enable_if_convertible is never specified, so we
don't know what this is supposed to do. Second: we could reasonably
say that this overload should be disabled in certain cases or we
could reasonably say that behavior is undefined, but we can't say
both.</p>
<p>Thomas Witt writes that the goal of putting in
enable_if_convertible here is to make sure that a specific overload
doesn't interfere with the generic case except when that overload
makes sense. He agrees that what we currently have is deficient.
Dave Abrahams writes that there is no conflict with the requires
cause because the requires clause only takes effect when the
function is actually called. The presence of the constructor
signature can/will be detected by is_convertible without violating
the requires clause, and thus it makes a difference to disable
those constructor instantiations that would be disabled by
enable_if_convertible even if calling them invokes undefined
behavior.  There was more discussion on the reflector:
c++std-lib-12312, c++std-lib-12325, c++std-lib- 12330,
c++std-lib-12334, c++std-lib-12335, c++std-lib-12336,
c++std-lib-12338, c++std-lib- 12362.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<blockquote>
[<em>Note:</em> The <tt class="literal"><span class="pre">enable_if_convertible&lt;X,Y&gt;::type</span></tt> expression
used in this section is for exposition purposes. The converting
constructors for specialized adaptors should be only be in an
overload set provided that an object of type <tt class="literal"><span class="pre">X</span></tt> is
implicitly convertible to an object of type <tt class="literal"><span class="pre">Y</span></tt>.  The
<tt class="literal"><span class="pre">enable_if_convertible</span></tt> approach uses SFINAE to take the
constructor out of the overload set when the types are not
implicitly convertible.]</blockquote>
<p>To:</p>
<blockquote class="last">
<p>The <tt class="literal"><span class="pre">enable_if_convertible&lt;X,Y&gt;::type</span></tt> expression used in
this section is for exposition purposes. The converting
constructors for specialized adaptors should be only be in an
overload set provided that an object of type <tt class="literal"><span class="pre">X</span></tt> is
implicitly convertible to an object of type <tt class="literal"><span class="pre">Y</span></tt>.  The
signatures involving <tt class="literal"><span class="pre">enable_if_convertible</span></tt> should behave
<em>as-if</em> <tt class="literal"><span class="pre">enable_if_convertible</span></tt> were defined to be:</p>
<pre class="literal-block">
template &lt;bool&gt; enable_if_convertible_impl
{};

template &lt;&gt; enable_if_convertible_impl&lt;true&gt;
{ struct type; };

template&lt;typename From, typename To&gt;
struct enable_if_convertible
  : enable_if_convertible_impl&lt;is_convertible&lt;From,To&gt;::value&gt;
{};
</pre>
<p>If an expression other than the default argument is used to
supply the value of a function parameter whose type is written
in terms of <tt class="literal"><span class="pre">enable_if_convertible</span></tt>, the program is
ill-formed, no diagnostic required.</p>
<p>[<em>Note:</em> The <tt class="literal"><span class="pre">enable_if_convertible</span></tt> approach uses SFINAE to
take the constructor out of the overload set when the types are
not implicitly convertible.  ]</p>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-adaptor-has-an-extraneous-bool-at-the-start-of-the-template-definition">
<h2><a class="toc-backref" href="#id6" name="iterator-adaptor-has-an-extraneous-bool-at-the-start-of-the-template-definition">9.5 iterator_adaptor has an extraneous 'bool' at the start of the template definition</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The title says it all; this is probably just a typo.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Remove the 'bool'.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="name-of-private-member-shouldn-t-be-normative">
<h2><a class="toc-backref" href="#id7" name="name-of-private-member-shouldn-t-be-normative">9.6 Name of private member shouldn't be normative</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>iterator_adaptor has a private member named m_iterator. Presumably
this is for exposition only, since it's an implementation
detail. It needs to be marked as such.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><dl class="first">
<dt>Mark the member <tt class="literal"><span class="pre">m_iterator</span></tt> as exposition</dt>
<dd>only.  Note/DWA: I think this is NAD because the user can't
detect it, though I'm happy to mark it exposition only.</dd>
</dl>
<p>In [lib.iterator.adaptor]</p>
<p>Change:</p>
<pre class="literal-block">
Base m_iterator;
</pre>
<p>to:</p>
<pre class="last literal-block">
Base m_iterator; // exposition only
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-adaptor-operations-specifications-are-a-bit-inconsistent">
<h2><a class="toc-backref" href="#id8" name="iterator-adaptor-operations-specifications-are-a-bit-inconsistent">9.7 iterator_adaptor operations specifications are a bit inconsistent</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>iterator_adpator() has a Requires clause, that Base must be default
constructible.  iterator_adaptor(Base) has no Requires clause,
although the Returns clause says that the Base member is copy
construced from the argument (this may actually be an oversight in
N1550, which doesn't require iterators to be copy constructible or
assignable).</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Add a requirements section for the template
parameters of iterator_adaptor, and state that Base must be Copy
Constructible and Assignable.</p>
<p class="last">N1550 does in fact include requirements for copy constructible
and assignable in the requirements tables. To clarify, we've also
added the requirements to the text.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="specialized-adaptors-text-should-be-normative">
<h2><a class="toc-backref" href="#id9" name="specialized-adaptors-text-should-be-normative">9.8 Specialized adaptors text should be normative</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>similar to 9.3, &quot;Specialized Adaptors&quot; has a note describing
enable_if_convertible. This should be normative text.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Changed it to normative
text.  See the resolution of 9.4</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="reverse-iterator-text-is-too-informal">
<h2><a class="toc-backref" href="#id10" name="reverse-iterator-text-is-too-informal">9.9 Reverse_iterator text is too informal</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>reverse iterator &quot;flips the direction of the base iterator's
motion&quot;. This needs to be more formal, as in the current
standard. Something like: &quot;iterates through the controlled sequence
in the opposite direction&quot;</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<blockquote>
The reverse iterator adaptor flips the direction of a base
iterator's motion. Invoking <tt class="literal"><span class="pre">operator++()</span></tt> moves the base
iterator backward and invoking <tt class="literal"><span class="pre">operator--()</span></tt> moves the base
iterator forward.</blockquote>
<p>to:</p>
<blockquote class="last">
The reverse iterator adaptor iterates through the adapted iterator
range in the opposite direction.</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="prior-is-undefined">
<h2><a class="toc-backref" href="#id11" name="prior-is-undefined">9.10 'prior' is undefined</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>reverse_iterator::dereference is specified as calling a function
named 'prior' which has no specification.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change the specification to avoid using <tt class="literal"><span class="pre">prior</span></tt> as follows.</p>
<p>Remove:</p>
<pre class="literal-block">
typename reverse_iterator::reference dereference() const { return *prior(this-&gt;base()); }
</pre>
<p>And at the end of the operations section add:</p>
<blockquote class="last">
<p><tt class="literal"><span class="pre">reference</span> <span class="pre">operator*()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<pre class="literal-block">
Iterator tmp = m_iterator;
return *--tmp;
</pre>
</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">The style of specification has changed because of issue 9.37x.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="in-other-words-is-bad-wording">
<h2><a class="toc-backref" href="#id12" name="in-other-words-is-bad-wording">9.11 &quot;In other words&quot; is bad wording</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>Transform iterator has a two-part specification: it does this, in
other words, it does that. &quot;In other words&quot; always means &quot;I didn't
say it right, so I'll try again.&quot; We need to say it once.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<blockquote>
The transform iterator adapts an iterator by applying some function
object to the result of dereferencing the iterator. In other words,
the <tt class="literal"><span class="pre">operator*</span></tt> of the transform iterator first dereferences the
base iterator, passes the result of this to the function object, and
then returns the result.</blockquote>
<p>to:</p>
<blockquote class="last">
The transform iterator adapts an iterator by modifying the
<tt class="literal"><span class="pre">operator*</span></tt> to apply a function object to the result of
dereferencing the iterator and returning the result.</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="transform-iterator-shouldn-t-mandate-private-member">
<h2><a class="toc-backref" href="#id13" name="transform-iterator-shouldn-t-mandate-private-member">9.12 Transform_iterator shouldn't mandate private member</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>transform_iterator has a private member named 'm_f' which should be
marked &quot;exposition only.&quot;</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Mark the member <tt class="literal"><span class="pre">m_f</span></tt> as exposition
only. Note/DWA: I think this is NAD because the user can't
detect it, though I'm happy to mark it exposition only.</p>
<p>Change:</p>
<pre class="literal-block">
UnaryFunction m_f;
</pre>
<p>to:</p>
<pre class="last literal-block">
UnaryFunction m_f;   // exposition only
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="unclear-description-of-counting-iterator">
<h2><a class="toc-backref" href="#id14" name="unclear-description-of-counting-iterator">9.13 Unclear description of counting iterator</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The description of Counting iterator is unclear. &quot;The counting
iterator adaptor implements dereference by returning a reference to
the base object. The other operations are implemented by the base
m_iterator, as per the inheritance from iterator_adaptor.&quot;</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<blockquote>
The counting iterator adaptor implements dereference by
returning a reference to the base object. The other operations
are implemented by the base <tt class="literal"><span class="pre">m_iterator</span></tt>, as per the
inheritance from <tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</blockquote>
<p>to:</p>
<blockquote class="last">
<tt class="literal"><span class="pre">counting_iterator</span></tt> adapts an object by adding an
<tt class="literal"><span class="pre">operator*</span></tt> that returns the current value of the object. All
other iterator operations are forwarded to the adapted object.</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="counting-iterator-s-difference-type">
<h2><a class="toc-backref" href="#id15" name="counting-iterator-s-difference-type">9.14 Counting_iterator's difference type</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>Counting iterator has the following note:</p>
<blockquote>
[Note: implementers are encouraged to provide an implementation
of distance_to and a difference_type that avoids overflows in the
cases when the Incrementable type is a numeric type.]</blockquote>
<p>I'm not sure what this means. The user provides a template argument
named Difference, but there's no difference_type. I assume this is
just a glitch in the wording. But if implementors are encouraged to
ignore this argument if it won't work right, why is it there?</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">The <tt class="literal"><span class="pre">difference_type</span></tt> was inherited from
<tt class="literal"><span class="pre">iterator_adaptor</span></tt>.  However, we've removed the explicit
inheritance, so explicit typedefs have been added. See the
resolution of 9.37x.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="how-to-detect-lvalueness">
<h2><a class="toc-backref" href="#id16" name="how-to-detect-lvalueness">9.15 How to detect lvalueness?</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>Shortly after N1550 was accepted, we discovered that an iterator's
lvalueness can be determined knowing only its value_type. This
predicate can be calculated even for old-style iterators (on whose
reference type the standard places few requirements). A trait in
the Boost iterator library does it by relying on the compiler's
unwillingness to bind an rvalue to a T&amp; function template
parameter. Similarly, it is possible to detect an iterator's
readability knowing only its value_type.  Thus, any interface which
asks the user to explicitly describe an iterator's lvalue-ness or
readability seems to introduce needless complexity.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><ol class="first arabic simple">
<li>Remove the <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> traits, and
remove the requirements in the Writable Iterator and Swappable
Iterator concepts that require their models to support these
traits.</li>
<li>Change the <tt class="literal"><span class="pre">is_readable</span></tt> specification.  Remove the
requirement for support of the <tt class="literal"><span class="pre">is_readable</span></tt> trait from the
Readable Iterator concept.</li>
<li>Remove the <tt class="literal"><span class="pre">iterator_tag</span></tt> class and transplant the logic for
choosing an iterator category into <tt class="literal"><span class="pre">iterator_facade</span></tt>.</li>
<li>Change the specification of <tt class="literal"><span class="pre">traversal_category</span></tt>.</li>
<li>Remove Access parameters from N1530</li>
</ol>
<p>In N1550:</p>
<p>Remove:</p>
<blockquote>
<p>Since the access concepts are not related via refinement, but
instead cover orthogonal issues, we do not use tags for the
access concepts, but instead use the equivalent of a bit field.</p>
<p>We provide an access mechanism for mapping iterator types to
the new traversal tags and access bit field. Our design reuses
<tt class="literal"><span class="pre">iterator_traits&lt;Iter&gt;::iterator_category</span></tt> as the access
mechanism. To that end, the access and traversal information is
bundled into a single type using the following <cite>iterator_tag</cite>
class.</p>
<pre class="literal-block">
enum iterator_access { readable_iterator = 1, writable_iterator = 2, 
    swappable_iterator = 4, lvalue_iterator = 8 };

template &lt;unsigned int access_bits, class TraversalTag&gt;
struct iterator_tag : /* appropriate old category or categories */ {
  static const iterator_access access =
    (iterator_access)access_bits &amp; 
      (readable_iterator | writable_iterator | swappable_iterator);
  typedef TraversalTag traversal;
};
</pre>
<p>The <tt class="literal"><span class="pre">access_bits</span></tt> argument is declared to be <tt class="literal"><span class="pre">unsigned</span> <span class="pre">int</span></tt>
instead of the enum <tt class="literal"><span class="pre">iterator_access</span></tt> for convenience of
use. For example, the expression <tt class="literal"><span class="pre">(readable_iterator</span> <span class="pre">|</span>
<span class="pre">writable_iterator)</span></tt> produces an unsigned int, not an
<tt class="literal"><span class="pre">iterator_access</span></tt>.  The purpose of the <tt class="literal"><span class="pre">lvalue_iterator</span></tt>
part of the <tt class="literal"><span class="pre">iterator_access</span></tt> enum is to communicate to
<tt class="literal"><span class="pre">iterator_tag</span></tt> whether the reference type is an lvalue so
that the appropriate old category can be chosen for the base
class. The <tt class="literal"><span class="pre">lvalue_iterator</span></tt> bit is not recorded in the
<tt class="literal"><span class="pre">iterator_tag::access</span></tt> data member.</p>
<p>The <tt class="literal"><span class="pre">iterator_tag</span></tt> class template is derived from the
appropriate iterator tag or tags from the old requirements
based on the access bits and traversal tag passed as template
parameters.  The algorithm for determining the old tag or tags
picks the least refined old concepts that include all of the
requirements of the access and traversal concepts (that is, the
closest fit), if any such category exists.  For example, the
category tag for a Readable Single Pass Iterator will always be
derived from <tt class="literal"><span class="pre">input_iterator_tag</span></tt>, while the category tag for
a Single Pass Iterator that is both Readable and Writable will
be derived from both <tt class="literal"><span class="pre">input_iterator_tag</span></tt> and
<tt class="literal"><span class="pre">output_iterator_tag</span></tt>.</p>
<p>We also provide several helper classes that make it convenient
to obtain the access and traversal characteristics of an
iterator. These helper classes work both for iterators whose
<tt class="literal"><span class="pre">iterator_category</span></tt> is <tt class="literal"><span class="pre">iterator_tag</span></tt> and also for
iterators using the original iterator categories.</p>
<pre class="literal-block">
template &lt;class Iterator&gt; struct is_readable  { typedef ... type; };
template &lt;class Iterator&gt; struct is_writable { typedef ... type; };
template &lt;class Iterator&gt; struct is_swappable { typedef ... type; };
template &lt;class Iterator&gt; struct traversal_category { typedef ... type; };
</pre>
</blockquote>
<p>After:</p>
<blockquote>
Like the old iterator requirements, we provide tags for
purposes of dispatching based on the traversal concepts.  The
tags are related via inheritance so that a tag is convertible
to another tag if the concept associated with the first tag is
a refinement of the second tag.</blockquote>
<p>Add:</p>
<blockquote>
<p>Our design reuses <tt class="literal"><span class="pre">iterator_traits&lt;Iter&gt;::iterator_category</span></tt>
to indicate an iterator's traversal capability.  To specify
capabilities not captured by any old-style iterator category,
an iterator designer can use an <tt class="literal"><span class="pre">iterator_category</span></tt> type that
is convertible to both the the most-derived old iterator
category tag which fits, and the appropriate new iterator
traversal tag.</p>
<p>We do not provide tags for the purposes of dispatching based on
the access concepts, in part because we could not find a way to
automatically infer the right access tags for old-style
iterators.  An iterator's writability may be dependent on the
assignability of its <tt class="literal"><span class="pre">value_type</span></tt> and there's no known way to
detect whether an arbitrary type is assignable.  Fortunately,
the need for dispatching based on access capability is not as
great as the need for dispatching based on traversal
capability.</p>
</blockquote>
<p>From the Readable Iterator Requirements table, remove:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="37%" />
<col width="37%" />
<col width="26%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">is_readable&lt;X&gt;::type</span></tt></td>
<td><tt class="literal"><span class="pre">true_type</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>From the Writable Iterator Requirements table, remove:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="37%" />
<col width="21%" />
<col width="42%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">is_writable&lt;X&gt;::type</span></tt></td>
<td><tt class="literal"><span class="pre">true_type</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>From the Swappable Iterator Requirements table, remove:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="37%" />
<col width="19%" />
<col width="43%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">is_swappable&lt;X&gt;::type</span></tt></td>
<td><tt class="literal"><span class="pre">true_type</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>From [lib.iterator.synopsis] replace:</p>
<pre class="literal-block">
template &lt;class Iterator&gt; struct is_readable;
template &lt;class Iterator&gt; struct is_writable;
template &lt;class Iterator&gt; struct is_swappable;
template &lt;class Iterator&gt; struct traversal_category;

enum iterator_access { readable_iterator = 1, writable_iterator = 2, 
    swappable_iterator = 4, lvalue_iterator = 8 };

template &lt;unsigned int access_bits, class TraversalTag&gt;
struct iterator_tag : /* appropriate old category or categories */ {
  static const iterator_access access =
    (iterator_access)access_bits &amp; 
      (readable_iterator | writable_iterator | swappable_iterator);
  typedef TraversalTag traversal;
};
</pre>
<p>with:</p>
<pre class="literal-block">
template &lt;class Iterator&gt; struct is_readable_iterator;
template &lt;class Iterator&gt; struct iterator_traversal;
</pre>
<p>In [lib.iterator.traits], remove:</p>
<blockquote>
<p>The <tt class="literal"><span class="pre">iterator_tag</span></tt> class template is an iterator category tag
that encodes the access enum and traversal tag in addition to
being compatible with the original iterator tags.  The
<tt class="literal"><span class="pre">iterator_tag</span></tt> class inherits from one of the original
iterator tags according to the following pseudo-code.</p>
<pre class="literal-block">
inherit-category(access, traversal-tag) =
     if ((access &amp; readable_iterator) &amp;&amp; (access &amp; lvalue_iterator)) {
         if (traversal-tag is convertible to random_access_traversal_tag)
             return random_access_iterator_tag;
         else if (traversal-tag is convertible to bidirectional_traversal_tag)
             return bidirectional_iterator_tag;
         else if (traversal-tag is convertible to forward_traversal_tag)
             return forward_iterator_tag;
         else if (traversal-tag is convertible to single_pass_traversal_tag)
             if (access-tag is convertible to writable_iterator_tag)
                 return input_output_iterator_tag;
             else
                 return input_iterator_tag;
         else
             return null_category_tag;
     } else if ((access &amp; readable_iterator) and (access &amp; writable_iterator)
                and traversal-tag is convertible to single_pass_iterator_tag)
         return input_output_iterator_tag;
     else if (access &amp; readable_iterator
              and traversal-tag is convertible to single_pass_iterator_tag)
         return input_iterator_tag;
     else if (access &amp; writable_iterator
              and traversal-tag is convertible to incrementable_iterator_tag)
         return output_iterator_tag;
     else
         return null_category_tag;
</pre>
<p>If the argument for <tt class="literal"><span class="pre">TraversalTag</span></tt> is not convertible to
<tt class="literal"><span class="pre">incrementable_iterator_tag</span></tt> then the program is ill-formed.</p>
</blockquote>
<p>Change:</p>
<blockquote>
<p>The <tt class="literal"><span class="pre">is_readable</span></tt>, <tt class="literal"><span class="pre">is_writable</span></tt>, <tt class="literal"><span class="pre">is_swappable</span></tt>, and
<tt class="literal"><span class="pre">traversal_category</span></tt> class templates are traits classes. For
iterators whose <tt class="literal"><span class="pre">iterator_traits&lt;Iter&gt;::iterator_category</span></tt>
type is <tt class="literal"><span class="pre">iterator_tag</span></tt>, these traits obtain the <tt class="literal"><span class="pre">access</span></tt>
enum and <tt class="literal"><span class="pre">traversal</span></tt> member type from within
<tt class="literal"><span class="pre">iterator_tag</span></tt>.  For iterators whose
<tt class="literal"><span class="pre">iterator_traits&lt;Iter&gt;::iterator_category</span></tt> type is not
<tt class="literal"><span class="pre">iterator_tag</span></tt> and instead is a tag convertible to one of the
original tags, the appropriate traversal tag and access bits
are deduced.  The following pseudo-code describes the
algorithm.</p>
<pre class="literal-block">
is-readable(Iterator) = 
    cat = iterator_traits&lt;Iterator&gt;::iterator_category;
    if (cat == iterator_tag&lt;Access,Traversal&gt;)
        return Access &amp; readable_iterator;
    else if (cat is convertible to input_iterator_tag)
        return true;
    else
        return false;

is-writable(Iterator) =
    cat = iterator_traits&lt;Iterator&gt;::iterator_category;
    if (cat == iterator_tag&lt;Access,Traversal&gt;)
        return Access &amp; writable_iterator;
    else if (cat is convertible to output_iterator_tag)
         return true;
    else if (
         cat is convertible to forward_iterator_tag
         and iterator_traits&lt;Iterator&gt;::reference is a 
             mutable reference)
        return true;
    else
        return false;

is-swappable(Iterator) =
    cat = iterator_traits&lt;Iterator&gt;::iterator_category;
    if (cat == iterator_tag&lt;Access,Traversal&gt;)
        return Access &amp; swappable_iterator;
    else if (cat is convertible to forward_iterator_tag) {
        if (iterator_traits&lt;Iterator&gt;::reference is a const reference)
            return false;
        else
            return true;
    } else 
        return false;

traversal-category(Iterator) =
    cat = iterator_traits&lt;Iterator&gt;::iterator_category;
    if (cat == iterator_tag&lt;Access,Traversal&gt;)
        return Traversal;
    else if (cat is convertible to random_access_iterator_tag)
        return random_access_traversal_tag;
    else if (cat is convertible to bidirectional_iterator_tag)
        return bidirectional_traversal_tag;
    else if (cat is convertible to forward_iterator_tag)
        return forward_traversal_tag;
    else if (cat is convertible to input_iterator_tag)
        return single_pass_iterator_tag;
    else if (cat is convertible to output_iterator_tag)
        return incrementable_iterator_tag;
    else
        return null_category_tag;
</pre>
<p>The following specializations provide the access and traversal
category tags for pointer types.</p>
<pre class="literal-block">
template &lt;typename T&gt;
struct is_readable&lt;const T*&gt; { typedef true_type type; };
template &lt;typename T&gt;
struct is_writable&lt;const T*&gt; { typedef false_type type; };
template &lt;typename T&gt;
struct is_swappable&lt;const T*&gt; { typedef false_type type; };

template &lt;typename T&gt;
struct is_readable&lt;T*&gt; { typedef true_type type; };
template &lt;typename T&gt;
struct is_writable&lt;T*&gt; { typedef true_type type; };
template &lt;typename T&gt;
struct is_swappable&lt;T*&gt; { typedef true_type type; };

template &lt;typename T&gt;
struct traversal_category&lt;T*&gt;
{
  typedef random_access_traversal_tag type;
};
</pre>
</blockquote>
<p>to:</p>
<blockquote>
<p>The <tt class="literal"><span class="pre">is_readable_iterator</span></tt> class template satisfies the
UnaryTypeTrait requirements.</p>
<p>Given an iterator type <tt class="literal"><span class="pre">X</span></tt>,
<tt class="literal"><span class="pre">is_readable_iterator&lt;X&gt;::value</span></tt> yields <tt class="literal"><span class="pre">true</span></tt> if, for an
object <tt class="literal"><span class="pre">a</span></tt> of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">*a</span></tt> is convertible to
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::value_type</span></tt>, and <tt class="literal"><span class="pre">false</span></tt> otherwise.</p>
<a class="target" id="category-to-traversal" name="category-to-traversal"></a><p><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt> is</p>
<pre class="literal-block">
<em>category-to-traversal</em>(iterator_traits&lt;X&gt;::iterator_category) 
</pre>
<p>where <em>category-to-traversal</em> is defined as follows</p>
<pre class="literal-block">
<em>category-to-traversal</em>(C) =
    if (C is convertible to incrementable_traversal_tag)
        return C;
    else if (C is convertible to random_access_iterator_tag)
        return random_access_traversal_tag;
    else if (C is convertible to bidirectional_iterator_tag)
        return bidirectional_traversal_tag;
    else if (C is convertible to forward_iterator_tag)
        return forward_traversal_tag;
    else if (C is convertible to input_iterator_tag)
        return single_pass_traversal_tag;
    else if (C is convertible to output_iterator_tag)
        return incrementable_traversal_tag;
    else
        <em>the program is ill-formed</em>
</pre>
</blockquote>
<p>In N1530:</p>
<p>In [lib.iterator.helper.synopsis]:</p>
<p>Change:</p>
<pre class="literal-block">
const unsigned use_default_access = -1;

struct iterator_core_access { /* implementation detail */ };

template &lt;
    class Derived
  , class Value
  , unsigned AccessCategory
  , class TraversalCategory
  , class Reference  = Value&amp;
  , class Difference = ptrdiff_t
&gt;
class iterator_facade;

template &lt;
    class Derived
  , class Base
  , class Value      = use_default
  , unsigned Access  = use_default_access
  , class Traversal  = use_default
  , class Reference  = use_default
  , class Difference = use_default
&gt;
class iterator_adaptor;

template &lt;
    class Iterator
  , class Value = use_default
  , unsigned Access  = use_default_access
  , class Traversal  = use_default
  , class Reference = use_default
  , class Difference = use_default
&gt;
class indirect_iterator;
</pre>
<p>To:</p>
<pre class="literal-block">
struct iterator_core_access { /* implementation detail */ };

template &lt;
    class Derived
  , class Value
  , class CategoryOrTraversal
  , class Reference  = Value&amp;
  , class Difference = ptrdiff_t
&gt;
class iterator_facade;

template &lt;
    class Derived
  , class Base
  , class Value      = use_default
  , class CategoryOrTraversal  = use_default
  , class Reference  = use_default
  , class Difference = use_default
&gt;
class iterator_adaptor;

template &lt;
    class Iterator
  , class Value = use_default
  , class CategoryOrTraversal = use_default
  , class Reference = use_default
  , class Difference = use_default
&gt;
class indirect_iterator;
</pre>
<p>Change:</p>
<pre class="literal-block">
template &lt;
    class Incrementable
  , unsigned Access  = use_default_access
  , class Traversal  = use_default
  , class Difference = use_default
&gt;
class counting_iterator
</pre>
<p>To:</p>
<pre class="literal-block">
template &lt;
    class Incrementable
  , class CategoryOrTraversal  = use_default
  , class Difference = use_default
&gt;
class counting_iterator;
</pre>
<p>In [lib.iterator.facade]:</p>
<p>Change:</p>
<pre class="literal-block">
template &lt;
    class Derived
  , class Value
  , unsigned AccessCategory
  , class TraversalCategory
  , class Reference  = /* see below */
  , class Difference = ptrdiff_t
&gt;
class iterator_facade {
</pre>
<p>to:</p>
<pre class="literal-block">
template &lt;
    class Derived
  , class Value
  , class CategoryOrTraversal
  , class Reference  = Value&amp;
  , class Difference = ptrdiff_t
&gt;
class iterator_facade {
</pre>
<p>Change:</p>
<pre class="literal-block">
typedef iterator_tag&lt;AccessCategory, TraversalCategory&gt; iterator_category;
</pre>
<p>to:</p>
<pre class="literal-block">
typedef /* see below */ iterator_category;
</pre>
<p>Change:</p>
<pre class="literal-block">
// Comparison operators
template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type // exposition
operator ==(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator !=(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator &lt;(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator &lt;=(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator &gt;(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator &gt;=(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator &gt;=(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

// Iterator difference
template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1,
          class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator -(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs);

// Iterator addition
template &lt;class Derived, class V, class AC, class TC, class R, class D&gt;
Derived operator+ (iterator_facade&lt;Derived, V, AC, TC, R, D&gt; const&amp;,
                   typename Derived::difference_type n)
</pre>
<p>to:</p>
<pre class="literal-block">
// Comparison operators
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type // exposition
operator ==(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator !=(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &lt;(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &lt;=(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &gt;(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &gt;=(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

// Iterator difference
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
/* see below */
operator-(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
          iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);

// Iterator addition
template &lt;class Dr, class V, class TC, class R, class D&gt;
Derived operator+ (iterator_facade&lt;Dr,V,TC,R,D&gt; const&amp;,
                   typename Derived::difference_type n);

template &lt;class Dr, class V, class TC, class R, class D&gt;
Derived operator+ (typename Derived::difference_type n,
                   iterator_facade&lt;Dr,V,TC,R,D&gt; const&amp;);
</pre>
<p>After the <tt class="literal"><span class="pre">iterator_facade</span></tt> synopsis, add:</p>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member of <tt class="literal"><span class="pre">iterator_facade</span></tt> is</p>
<pre class="literal-block">
<em>iterator-category</em>(CategoryOrTraversal, value_type, reference)
</pre>
<p>where <em>iterator-category</em> is defined as follows:</p>
<pre class="last literal-block">
<em>iterator-category</em>(C,R,V) :=
   if (C is convertible to std::input_iterator_tag
       || C is convertible to std::output_iterator_tag
   )
       return C

   else if (C is not convertible to incrementable_traversal_tag)
       <em>the program is ill-formed</em>

   else return a type X satisfying the following two constraints:

      1. X is convertible to X1, and not to any more-derived
         type, where X1 is defined by:

           if (R is a reference type
               &amp;&amp; C is convertible to forward_traversal_tag)
           {
               if (C is convertible to random_access_traversal_tag)
                   X1 = random_access_iterator_tag
               else if (C is convertible to bidirectional_traversal_tag)
                   X1 = bidirectional_iterator_tag
               else
                   X1 = forward_iterator_tag
           }
           else
           {
               if (C is convertible to single_pass_traversal_tag
                   &amp;&amp; R is convertible to V)
                   X1 = input_iterator_tag
               else
                   X1 = C
           }

      2. <a class="reference" href="#category-to-traversal"><em>category-to-traversal</em></a>(X) is convertible to the most
         derived traversal tag type to which X is also
         convertible, and not to any more-derived traversal tag
         type.
</pre>
</td>
</tr>
</tbody>
</table>
<a class="target" id="iterator-category" name="iterator-category"></a><blockquote>
<p>In [lib.iterator.facade] <tt class="literal"><span class="pre">iterator_facade</span></tt> requirements:</p>
<p>Remove:</p>
<blockquote>
<tt class="literal"><span class="pre">AccessCategory</span></tt> must be an unsigned value which uses no more
bits than the greatest value of <tt class="literal"><span class="pre">iterator_access</span></tt>.</blockquote>
<p>In the <strong>Iterator Adaptor</strong> section, change:</p>
<blockquote>
Several of the template parameters of <tt class="literal"><span class="pre">iterator_adaptor</span></tt> default
to <tt class="literal"><span class="pre">use_default</span></tt> (or <tt class="literal"><span class="pre">use_default_access</span></tt>).</blockquote>
<p>to:</p>
<blockquote>
Several of the template parameters of <tt class="literal"><span class="pre">iterator_adaptor</span></tt> default
to <tt class="literal"><span class="pre">use_default</span></tt>.</blockquote>
<p>In [lib.iterator.special.adaptors]:</p>
<p>Change:</p>
<pre class="literal-block">
template &lt;
    class Iterator
  , class Value = use_default
  , unsigned Access  = use_default_access
  , class Traversal  = use_default
  , class Reference = use_default
  , class Difference = use_default
&gt;
class indirect_iterator
</pre>
<p>to:</p>
<pre class="literal-block">
template &lt;
    class Iterator
  , class Value = use_default
  , class CategoryOrTraversal = use_default
  , class Reference = use_default
  , class Difference = use_default
&gt;
class indirect_iterator
</pre>
<p>Change:</p>
<pre class="literal-block">
template &lt;
    class Iterator2, class Value2, unsigned Access2, class Traversal2
  , class Reference2, class Difference2
&gt;
indirect_iterator(
</pre>
<p>to:</p>
<pre class="literal-block">
template &lt;
    class Iterator2, class Value2, class Category2
  , class Reference2, class Difference2
&gt;
indirect_iterator(
</pre>
<p>Change:</p>
<pre class="literal-block">
template &lt;
    class Incrementable
  , unsigned Access = use_default_access
  , class Traversal = use_default
  , class Difference = use_default
&gt;
class counting_iterator
</pre>
<p>to:</p>
<pre class="literal-block">
template &lt;
    class Incrementable
  , class CategoryOrTraversal = use_default
  , class Difference = use_default
&gt;
class counting_iterator
</pre>
<p>Change:</p>
<pre class="literal-block">
typedef iterator_tag&lt;
      writable_iterator
    , incrementable_traversal_tag
&gt; iterator_category;
</pre>
<p>to:</p>
<blockquote>
typedef std::output_iterator_tag iterator_category;</blockquote>
<p>In [lib.iterator.adaptor]</p>
<p>Change:</p>
<pre class="literal-block">
template &lt;
    class Derived
  , class Base
  , class Value      = use_default
  , unsigned Access  = use_default_access
  , class Traversal  = use_default
  , class Reference  = use_default
  , class Difference = use_default
&gt;
class iterator_adaptor 
</pre>
<p>To:</p>
<pre class="literal-block">
template &lt;
    class Derived
  , class Base
  , class Value               = use_default
  , class CategoryOrTraversal = use_default
  , class Reference           = use_default
  , class Difference = use_default
&gt;
class iterator_adaptor 
</pre>
</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ol class="arabic simple">
<li>There are two reasons for removing <tt class="literal"><span class="pre">is_writable</span></tt>
and <tt class="literal"><span class="pre">is_swappable</span></tt>. The first is that we do not know of
a way to fix the specification so that it gives the correct
answer for all iterators. Second, there was only a weak
motivation for having <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt>
there in the first place.  The main motivation was simply
uniformity: we have tags for the old iterator categories
so we should have tags for the new iterator categories.
While having tags and the capability to dispatch based
on the traversal categories is often used, we see
less of a need for dispatching based on writability
and swappability, since typically algorithms
that need these capabilities have no alternative if
they are not provided.</li>
<li>We discovered that the <tt class="literal"><span class="pre">is_readable</span></tt> trait can be implemented
using only the iterator type itself and its <tt class="literal"><span class="pre">value_type</span></tt>.
Therefore we remove the requirement for <tt class="literal"><span class="pre">is_readable</span></tt> from the
Readable Iterator concept, and change the definition of
<tt class="literal"><span class="pre">is_readable</span></tt> so that it works for any iterator type.</li>
<li>The purpose of the <tt class="literal"><span class="pre">iterator_tag</span></tt> class was to bundle the
traversal and access category tags into the
<tt class="literal"><span class="pre">iterator_category</span></tt> typedef.  With <tt class="literal"><span class="pre">is_writable</span></tt> and
<tt class="literal"><span class="pre">is_swappable</span></tt> gone, and <tt class="literal"><span class="pre">is_readable</span></tt> no longer in need of
special hints, there is no reason for iterators to provide
information about the access capabilities of an iterator.  Thus
there is no need for the <tt class="literal"><span class="pre">iterator_tag</span></tt>. The traversal tag can
be directly used for the <tt class="literal"><span class="pre">iterator_category</span></tt>. If a new
iterator is intended to be backward compatible with old iterator
concepts, a tag type that is convertible to both one of the new
traversal tags and also to an old iterator tag can be created
and use for the <tt class="literal"><span class="pre">iterator_category</span></tt>.</li>
<li>The changes to the specification of <tt class="literal"><span class="pre">traversal_category</span></tt> are a 
direct result of the removal of <tt class="literal"><span class="pre">iterator_tag</span></tt>.</li>
</ol>
</div>
<div class="section" id="is-writable-iterator-returns-false-positives">
<h2><a class="toc-backref" href="#id17" name="is-writable-iterator-returns-false-positives">9.16 is_writable_iterator returns false positives</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>is_writable_iterator returns false positives for forward iterators
whose value_type has a private assignment operator, or whose
reference type is not a reference (currently legal).</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed Resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">See the resolution to 9.15.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="is-swappable-iterator-returns-false-positives">
<h2><a class="toc-backref" href="#id18" name="is-swappable-iterator-returns-false-positives">9.17 is_swappable_iterator returns false positives</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>is_swappable_iterator has the same problems as
is_writable_iterator. In addition, if we allow users to write their
own iter_swap functions it's easy to imagine old-style iterators
for which is_swappable returns false negatives.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed Resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">See the resolution to 9.15.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="are-is-readable-is-writable-and-is-swappable-useful">
<h2><a class="toc-backref" href="#id19" name="are-is-readable-is-writable-and-is-swappable-useful">9.18 Are is_readable, is_writable, and is_swappable useful?</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>I am concerned that there is little use for any of is_readable,
is_writable, or is_swappable, and that not only do they unduly
constrain iterator implementors but they add overhead to
iterator_facade and iterator_adaptor in the form of a template
parameter which would otherwise be unneeded. Since we can't
implement two of them accurately for old-style iterators, I am
having a hard time justifying their impact on the rest of the
proposal(s).</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed Resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">See the resolution to 9.15.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="non-uniformity-of-the-lvalue-iterator-bit">
<h2><a class="toc-backref" href="#id20" name="non-uniformity-of-the-lvalue-iterator-bit">9.19 Non-Uniformity of the &quot;lvalue_iterator Bit&quot;</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The proposed iterator_tag class template accepts an &quot;access bits&quot;
parameter which includes a bit to indicate the iterator's
lvalueness (whether its dereference operator returns a reference to
its value_type. The relevant part of N1550 says:</p>
<blockquote>
The purpose of the lvalue_iterator part of the iterator_access
enum is to communicate to iterator_tagwhether the reference type
is an lvalue so that the appropriate old category can be chosen
for the base class. The lvalue_iterator bit is not recorded in
the iterator_tag::access data member.</blockquote>
<p>The lvalue_iterator bit is not recorded because N1550 aims to
improve orthogonality of the iterator concepts, and a new-style
iterator's lvalueness is detectable by examining its reference
type. This inside/outside difference is awkward and confusing.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed Resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">The iterator_tag class will be removed, so this is no longer an issue.
See the resolution to 9.15.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="traversal-concepts-and-tags">
<h2><a class="toc-backref" href="#id21" name="traversal-concepts-and-tags">9.20 Traversal Concepts and Tags</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>Howard Hinnant pointed out some inconsistencies with the naming of
these tag types:</p>
<pre class="literal-block">
incrementable_iterator_tag // ++r, r++ 
single_pass_iterator_tag // adds a == b, a != b 
forward_traversal_iterator_tag // adds multi-pass 
bidirectional_traversal_iterator_tag // adds --r, r--
random_access_traversal_iterator_tag // adds r+n,n+r,etc. 
</pre>
<p>Howard thought that it might be better if all tag names contained
the word &quot;traversal&quot;.  It's not clear that would result in the best
possible names, though. For example, incrementable iterators can
only make a single pass over their input. What really distinguishes
single pass iterators from incrementable iterators is not that they
can make a single pass, but that they are equality
comparable. Forward traversal iterators really distinguish
themselves by introducing multi-pass capability. Without entering
a &quot;Parkinson's Bicycle Shed&quot; type of discussion, it might be worth
giving the names of these tags (and the associated concepts) some
extra attention.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change the names of the traversal tags to the
following names:</p>
<pre class="literal-block">
incrementable_traversal_tag
single_pass_traversal_tag
forward_traversal_tag
bidirectional_traversal_tag
random_access_traversal_tag
</pre>
<p>In [lib.iterator.traversal]:</p>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="39%" />
<col width="37%" />
<col width="24%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">traversal_category&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">incrementable_iterator_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="39%" />
<col width="37%" />
<col width="24%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">incrementable_traversal_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="36%" />
<col width="33%" />
<col width="31%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">traversal_category&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">single_pass_iterator_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="36%" />
<col width="33%" />
<col width="31%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">single_pass_traversal_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="44%" />
<col width="39%" />
<col width="17%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">traversal_category&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">forward_traversal_iterator_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="38%" />
<col width="34%" />
<col width="27%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">forward_traversal_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="35%" />
<col width="44%" />
<col width="21%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">traversal_category&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">bidirectional_traversal_iterator_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="38%" />
<col width="37%" />
<col width="25%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">bidirectional_traversal_tag</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="31%" />
<col width="35%" />
<col width="18%" />
<col width="16%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">traversal_category&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">random_access_traversal_iterator_tag</span></tt></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="28%" />
<col width="30%" />
<col width="23%" />
<col width="20%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">random_access_traversal_tag</span></tt></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>In [lib.iterator.synopsis], change:</p>
<pre class="literal-block">
struct incrementable_iterator_tag { };
struct single_pass_iterator_tag : incrementable_iterator_tag { };
struct forward_traversal_tag : single_pass_iterator_tag { };
</pre>
<p>to:</p>
<pre class="literal-block">
struct incrementable_traversal_tag { };
struct single_pass_traversal_tag : incrementable_traversal_tag { };
struct forward_traversal_tag : single_pass_traversal_tag { };
</pre>
<p>Remove:</p>
<pre class="last literal-block">
struct null_category_tag { };
struct input_output_iterator_tag : input_iterator_tag, output_iterator_tag {};
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-derived-template-argument-underspecified">
<h2><a class="toc-backref" href="#id22" name="iterator-facade-derived-template-argument-underspecified">9.21 iterator_facade Derived template argument underspecified</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The first template argument to iterator_facade is named Derived,
and the proposal says:</p>
<blockquote>
The Derived template parameter must be a class derived from
iterator_facade.</blockquote>
<p>First, iterator_facade is a template, so cannot be derived
from. Rather, the class must be derived from a specialization of
iterator_facade. More important, isn't Derived required to be the
class that is being defined? That is, if I understand it right, the
definition of D here this is not valid:</p>
<pre class="literal-block">
class C : public iterator_facade&lt;C, ... &gt; { ... }; 
class D : public iterator_facade&lt;C, ...&gt; { ... }; 
</pre>
<p>In the definition of D, the Derived argument to iterator_facade is
a class derived from a specialization of iterator_facade, so the
requirement is met. Shouldn't the requirement be more like &quot;when
using iterator_facade to define an iterator class Iter, the class
Iter must be derived from a specialization of iterator_facade whose
first template argument is Iter.&quot; That's a bit awkward, but at the
moment I don't see a better way of phrasing it.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">In [lib.iterator.facade]</p>
<p>Remove:</p>
<blockquote>
The <tt class="literal"><span class="pre">Derived</span></tt> template parameter must be a class derived from
<tt class="literal"><span class="pre">iterator_facade</span></tt>.</blockquote>
<p>Change:</p>
<blockquote>
The following table describes the other requirements on the
<tt class="literal"><span class="pre">Derived</span></tt> parameter.  Depending on the resulting iterator's
<tt class="literal"><span class="pre">iterator_category</span></tt>, a subset of the expressions listed in the table
are required to be valid.  The operations in the first column must be
accessible to member functions of class <tt class="literal"><span class="pre">iterator_core_access</span></tt>.</blockquote>
<p>to:</p>
<blockquote>
The following table describes the typical valid expressions on
<tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Derived</span></tt> parameter, depending on the
iterator concept(s) it will model.  The operations in the first
column must be made accessible to member functions of class
<tt class="literal"><span class="pre">iterator_core_access</span></tt>.  In addition,
<tt class="literal"><span class="pre">static_cast&lt;Derived*&gt;(iterator_facade*)</span></tt> shall be well-formed.</blockquote>
<p>In [lib.iterator.adaptor]</p>
<p>Change:</p>
<blockquote>
The <tt class="literal"><span class="pre">iterator_adaptor</span></tt> is a base class template derived from
an instantiation of <tt class="literal"><span class="pre">iterator_facade</span></tt>.</blockquote>
<p>to:</p>
<blockquote>
Each specialization of the <tt class="literal"><span class="pre">iterator_adaptor</span></tt> class template
is derived from a specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt>.</blockquote>
<p>Change:</p>
<blockquote>
The <tt class="literal"><span class="pre">Derived</span></tt> template parameter must be a derived class of
<tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</blockquote>
<p>To:</p>
<blockquote class="last">
<tt class="literal"><span class="pre">static_cast&lt;Derived*&gt;(iterator_adaptor*)</span></tt> shall be well-formed.</blockquote>
</td>
</tr>
</tbody>
</table>
<p>[Note: The proposed resolution to Issue 9.37 contains related
changes]</p>
</div>
<div class="section" id="return-type-of-iterator-difference-for-iterator-facade">
<h2><a class="toc-backref" href="#id23" name="return-type-of-iterator-difference-for-iterator-facade">9.22 return type of Iterator difference for iterator facade</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The proposal says:</p>
<pre class="literal-block">
template &lt;class Dr1, class V1, class AC1, class TC1, class R1, class D1, 
class Dr2, class V2, class AC2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1, Dr2, bool&gt;::type
operator -(iterator_facade&lt;Dr1, V1, AC1, TC1, R1, D1&gt; const&amp; lhs, 
iterator_facade&lt;Dr2, V2, AC2, TC2, R2, D2&gt; const&amp; rhs); 
</pre>
<p>Shouldn't the return type be one of the two iterator types? Which
one? The idea is that if one of the iterator types can be converted
to the other type, then the subtraction is okay. Seems like the
return type should then be the type that was converted to. Is that
right?</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">See resolution to 9.34.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-minor-wording-issue">
<h2><a class="toc-backref" href="#id24" name="iterator-facade-minor-wording-issue">9.23 Iterator_facade: minor wording Issue</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>In the table that lists the required (sort of) member functions of
iterator types that are based on iterator_facade, the entry for
c.equal(y) says:</p>
<blockquote>
true iff c and y refer to the same position. Implements c == y
and c != y.  The second sentence is inside out. c.equal(y) does
not implement either of these operations. It is used to implement
them. Same thing in the description of c.distance_to(z).</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">remove &quot;implements&quot; descriptions from
table.  See resolution to 9.34</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="use-of-undefined-name-in-iterator-facade-table">
<h2><a class="toc-backref" href="#id25" name="use-of-undefined-name-in-iterator-facade-table">9.24 Use of undefined name in iterator_facade table</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>Several of the descriptions use the name X without defining
it. This seems to be a carryover from the table immediately above
this section, but the text preceding that table says &quot;In the table
below, X is the derived iterator type.&quot; Looks like the X::
qualifiers aren't really needed; X::reference can simply be
reference, since that's defined by the iterator_facade
specialization itself.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Remove references to X.</p>
<p>In [lib.iterator.facade] operations <tt class="literal"><span class="pre">operator-&gt;()</span> <span class="pre">const;</span></tt>:</p>
<blockquote class="last">
<p>Change:</p>
<blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">If <tt class="literal"><span class="pre">X::reference</span></tt> is a reference type, an object
of type <tt class="literal"><span class="pre">X::pointer</span></tt> equal to:</p>
<pre class="literal-block">
&amp;static_cast&lt;Derived const*&gt;(this)-&gt;dereference()
</pre>
<p>Otherwise returns an object of unspecified type such that,
given an object <tt class="literal"><span class="pre">a</span></tt> of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">a-&gt;m</span></tt> is equivalent
to <tt class="literal"><span class="pre">(w</span> <span class="pre">=</span> <span class="pre">*a,</span> <span class="pre">w.m)</span></tt> for some temporary object <tt class="literal"><span class="pre">w</span></tt> of type
<tt class="literal"><span class="pre">X::value_type</span></tt>.</p>
<p class="last">The type <tt class="literal"><span class="pre">X::pointer</span></tt> is <tt class="literal"><span class="pre">Value*</span></tt> if
<tt class="literal"><span class="pre">is_writable_iterator&lt;X&gt;::value</span></tt> is <tt class="literal"><span class="pre">true</span></tt>, and
<tt class="literal"><span class="pre">Value</span> <span class="pre">const*</span></tt> otherwise.</p>
</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">If <tt class="literal"><span class="pre">reference</span></tt> is a reference type, an object
of type <tt class="literal"><span class="pre">pointer</span></tt> equal to:</p>
<pre class="literal-block">
&amp;static_cast&lt;Derived const*&gt;(this)-&gt;dereference()
</pre>
<p class="last">Otherwise returns an object of unspecified type such that,
<tt class="literal"><span class="pre">(*static_cast&lt;Derived</span> <span class="pre">const*&gt;(this))-&gt;m</span></tt> is equivalent
to <tt class="literal"><span class="pre">(w</span> <span class="pre">=</span> <span class="pre">**static_cast&lt;Derived</span> <span class="pre">const*&gt;(this),</span> <span class="pre">w.m)</span></tt> for
some temporary object <tt class="literal"><span class="pre">w</span></tt> of type <tt class="literal"><span class="pre">value_type</span></tt>.</p>
</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Further changes are covered by issue 9.26.</p>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-wrong-return-type">
<h2><a class="toc-backref" href="#id26" name="iterator-facade-wrong-return-type">9.25 Iterator_facade: wrong return type</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>Several of the member functions return a Derived object or a
Derived&amp;. Their Effects clauses end with:</p>
<pre class="literal-block">
return *this;
</pre>
<p>This should be</p>
<pre class="literal-block">
return *static_cast&lt;Derived*&gt;(this);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">In [lib.iterator.facade], in the effects clause
of the following operations:</p>
<pre class="literal-block">
Derived&amp; operator++()
Derived&amp; operator--()
Derived&amp; operator+=(difference_type n)
Derived&amp; operator-=(difference_type n)
</pre>
<dl class="last">
<dt>Change:</dt>
<dd><tt class="literal"><span class="pre">return</span> <span class="pre">*this</span></tt></dd>
<dt>to:</dt>
<dd><tt class="literal"><span class="pre">return</span> <span class="pre">*static_cast&lt;Derived*&gt;(this);</span></tt></dd>
</dl>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-unclear-returns-clause-for-operator">
<h2><a class="toc-backref" href="#id27" name="iterator-facade-unclear-returns-clause-for-operator">9.26 Iterator_facade: unclear returns clause for operator[]</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The returns clause for <tt class="literal"><span class="pre">operator[](difference_type</span> <span class="pre">n)</span></tt> const
says:</p>
<blockquote>
Returns: an object convertible to X::reference and holding a copy
p of a+n such that, for a constant object v of type
X::value_type, X::reference(a[n] = v) is equivalent to p = v.
This needs to define 'a', but assuming it's supposed to be
<tt class="literal"><span class="pre">*this</span></tt> (or maybe <tt class="literal"><span class="pre">*(Derived*)this</span></tt>), it still isn't clear
what this says. Presumably, the idea is that you can index off of
an iterator and assign to the result. But why the requirement
that it hold a copy of a+n? Granted, that's probably how it's
implemented, but it seems over-constrained. And the last phrase
seems wrong. p is an iterator; there's no requirement that you
can assign a value_type object to it. Should that be <tt class="literal"><span class="pre">*p</span> <span class="pre">=</span> <span class="pre">v</span></tt>?
But why the cast in reference(a[n] = v)?</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">In section operator[]:</p>
<blockquote>
<p>Change:</p>
<blockquote>
Writable iterators built with <tt class="literal"><span class="pre">iterator_facade</span></tt> implement
the semantics required by the preferred resolution to <cite>issue
299</cite> and adopted by proposal <cite>n1477</cite>: the result of <tt class="literal"><span class="pre">p[n]</span></tt>
is a proxy object containing a copy of <tt class="literal"><span class="pre">p+n</span></tt>, and <tt class="literal"><span class="pre">p[n]</span> <span class="pre">=</span>
<span class="pre">x</span></tt> is equivalent to <tt class="literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt>.  This approach will
work properly for any random-access iterator regardless of
the other details of its implementation.  A user who knows
more about the implementation of her iterator is free to
implement an <tt class="literal"><span class="pre">operator[]</span></tt> which returns an lvalue in the
derived iterator class; it will hide the one supplied by
<tt class="literal"><span class="pre">iterator_facade</span></tt> from clients of her iterator.</blockquote>
<p>to:</p>
<blockquote>
Writable iterators built with <tt class="literal"><span class="pre">iterator_facade</span></tt> implement
the semantics required by the preferred resolution to <cite>issue
299</cite> and adopted by proposal <cite>n1550</cite>: the result of <tt class="literal"><span class="pre">p[n]</span></tt>
is an object convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>,
and <tt class="literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is equivalent to <tt class="literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt> (Note:
This result object may be implemented as a proxy containing a
copy of <tt class="literal"><span class="pre">p+n</span></tt>).  This approach will work properly for any
random-access iterator regardless of the other details of its
implementation.  A user who knows more about the
implementation of her iterator is free to implement an
<tt class="literal"><span class="pre">operator[]</span></tt> that returns an lvalue in the derived iterator
class; it will hide the one supplied by <tt class="literal"><span class="pre">iterator_facade</span></tt>
from clients of her iterator.</blockquote>
</blockquote>
<p>In [lib.iterator.facade] operations:</p>
<blockquote class="last">
<p>Change:</p>
<blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an object convertible to <tt class="literal"><span class="pre">X::reference</span></tt> and
holding a copy <em>p</em> of <tt class="literal"><span class="pre">a+n</span></tt> such that, for a constant
object <tt class="literal"><span class="pre">v</span></tt> of type <tt class="literal"><span class="pre">X::value_type</span></tt>, <tt class="literal"><span class="pre">X::reference(a[n]</span>
<span class="pre">=</span> <span class="pre">v)</span></tt> is equivalent to <tt class="literal"><span class="pre">p</span> <span class="pre">=</span> <span class="pre">v</span></tt>.</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an object convertible to <tt class="literal"><span class="pre">value_type</span></tt>. For
constant objects <tt class="literal"><span class="pre">v</span></tt> of type <tt class="literal"><span class="pre">value_type</span></tt>, and <tt class="literal"><span class="pre">n</span></tt> of
type <tt class="literal"><span class="pre">difference_type</span></tt>, <tt class="literal"><span class="pre">(*this)[n]</span> <span class="pre">=</span> <span class="pre">v</span></tt> is equivalent
to <tt class="literal"><span class="pre">*(*this</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">v</span></tt>, and <tt class="literal"><span class="pre">static_cast&lt;value_type</span>
<span class="pre">const&amp;&gt;((*this)[n])</span></tt> is equivalent to
<tt class="literal"><span class="pre">static_cast&lt;value_type</span> <span class="pre">const&amp;&gt;(*(*this</span> <span class="pre">+</span> <span class="pre">n))</span></tt></td>
</tr>
</tbody>
</table>
</blockquote>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-redundant-clause">
<h2><a class="toc-backref" href="#id28" name="iterator-facade-redundant-clause">9.27 Iterator_facade: redundant clause</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">operator-</span></tt> has both an effects clause and a returns
clause. Looks like the returns clause should be removed.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Remove the returns clause.</p>
<p>In [lib.iterator.facade] operations:</p>
<dl class="last">
<dt>Remove:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">static_cast&lt;Derived</span> <span class="pre">const*&gt;(this)-&gt;advance(-n);</span></tt></td>
</tr>
</tbody>
</table>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="indirect-iterator-incorrect-specification-of-default-constructor">
<h2><a class="toc-backref" href="#id29" name="indirect-iterator-incorrect-specification-of-default-constructor">9.28 indirect_iterator: incorrect specification of default constructor</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The default constructor returns &quot;An instance of indirect_iterator
with a default constructed base object&quot;, but the constructor that
takes an Iterator object returns &quot;An instance of indirect_iterator
with the iterator_adaptor subobject copy constructed from x.&quot; The
latter is the correct form, since it does not reach inside the base
class for its semantics. So the default constructor shoudl return
&quot;An instance of indirect_iterator with a default-constructed
iterator_adaptor subobject.&quot;</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><dl class="first last">
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
a default constructed base object.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
a default-constructed <tt class="literal"><span class="pre">m_iterator</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">Inheritance from iterator_adaptor has been removed, so we instead
give the semantics in terms of the (exposition only) member
<tt class="literal"><span class="pre">m_iterator</span></tt>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="indirect-iterator-unclear-specification-of-template-constructor">
<h2><a class="toc-backref" href="#id30" name="indirect-iterator-unclear-specification-of-template-constructor">9.29 indirect_iterator: unclear specification of template constructor</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The templated constructor that takes an indirect_iterator with a
different set of template arguments says that it returns &quot;An
instance of indirect_iterator that is a copy of [the argument]&quot;.
But the type of the argument is different from the type of the
object being constructed, and there is no description of what
a &quot;copy&quot; means. The Iterator template parameter for the argument
must be convertible to the Iterator template parameter for the type
being constructed, which suggests that the argument's contained
Iterator object should be converted to the target type's Iterator
type.  Is that what's meant here?
(Pete later writes: In fact, this problem is present in all of the
specialized adaptors that have a constructor like this: the
constructor returns &quot;a copy&quot; of the argument without saying what a
copy is.)</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><dl class="first last">
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> that is a copy of <tt class="literal"><span class="pre">y</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> whose 
<tt class="literal"><span class="pre">m_iterator</span></tt> subobject is constructed from <tt class="literal"><span class="pre">y.base()</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">Inheritance from iterator_adaptor has been removed, so we
instead give the semantics in terms of the member <tt class="literal"><span class="pre">m_iterator</span></tt>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="transform-iterator-argument-irregularity">
<h2><a class="toc-backref" href="#id31" name="transform-iterator-argument-irregularity">9.30 transform_iterator argument irregularity</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>The specialized adaptors that take both a Value and a Reference
template argument all take them in that order, i.e. Value precedes
Reference in the template argument list, with the exception of
transform_iterator, where Reference precedes Value. This seems like
a possible source of confusion. Is there a reason why this order is
preferable?</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">NAD</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">defaults for Value depend on Reference.  A sensible
Value can almost always be computed from Reference.  The first
parameter is UnaryFunction, so the argument order is already
different from the other adapters.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="function-output-iterator-overconstrained">
<h2><a class="toc-backref" href="#id32" name="function-output-iterator-overconstrained">9.31 function_output_iterator overconstrained</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>function_output_iterator requirements says: &quot;The UnaryFunction must
be Assignable, Copy Constructible, and the expression f(x) must be
valid, where f is an object of type UnaryFunction and x is an
object of a type accepted by f.&quot;</p>
<p>Everything starting with &quot;and,&quot; somewhat reworded, is actually a
constraint on output_proxy::operator=. All that's needed to create
a function_output_iterator object is that the UnaryFunction type be
Assignable and CopyConstructible. That's also sufficient to
dereference and to increment such an object. It's only when you try
to assign through a dereferenced iterator that f(x) has to work,
and then only for the particular function object that the iterator
holds and for the particular value that is being assigned.</p>
<dl>
<dt>Addition from Jeremy:</dt>
<dd>The constructor for <tt class="literal"><span class="pre">function_output_iterator</span></tt> is also
slightly overconstrained because it requires 
the <tt class="literal"><span class="pre">UnaryFunction</span></tt> to have a default constructor
even when the default constructor of <tt class="literal"><span class="pre">function_output_iterator</span></tt>
is not used.</dd>
</dl>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><dl class="first">
<dt>Change:</dt>
<dd><tt class="literal"><span class="pre">output_proxy</span> <span class="pre">operator*();</span></tt></dd>
<dt>to:</dt>
<dd><tt class="literal"><span class="pre">/*</span> <span class="pre">see</span> <span class="pre">below</span> <span class="pre">*/</span> <span class="pre">operator*();</span></tt></dd>
</dl>
<p>After <tt class="literal"><span class="pre">function_output_iterator&amp;</span> <span class="pre">operator++(int);</span></tt> add:</p>
<pre class="literal-block">
private:
  UnaryFunction m_f;     // exposition only
</pre>
<dl>
<dt>Change:</dt>
<dd>The <tt class="literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible,
and the expression <tt class="literal"><span class="pre">f(x)</span></tt> must be valid, where <tt class="literal"><span class="pre">f</span></tt> is an
object of type <tt class="literal"><span class="pre">UnaryFunction</span></tt> and <tt class="literal"><span class="pre">x</span></tt> is an object of a
type accepted by <tt class="literal"><span class="pre">f</span></tt>.  The resulting
<tt class="literal"><span class="pre">function_output_iterator</span></tt> is a model of the Writable and
Incrementable Iterator concepts.</dd>
<dt>to:</dt>
<dd><tt class="literal"><span class="pre">UnaryFunction</span></tt> must be Assignable and Copy Constructible.</dd>
</dl>
<p class="last">After the requirements section, add:</p>
</td>
</tr>
</tbody>
</table>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">function_output_iterator</span></tt> models</p>
<blockquote>
<tt class="literal"><span class="pre">function_output_iterator</span></tt> is a model of the Writable and
Incrementable Iterator concepts.</blockquote>
<dl>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">function_output_iterator</span></tt> with
<tt class="literal"><span class="pre">f</span></tt> stored as a data member.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs an instance of <tt class="literal"><span class="pre">function_output_iterator</span></tt> 
with <tt class="literal"><span class="pre">m_f</span></tt> constructed from <tt class="literal"><span class="pre">f</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><p class="first"><tt class="literal"><span class="pre">output_proxy</span> <span class="pre">operator*();</span></tt></p>
<table class="last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">output_proxy</span></tt> constructed with
a copy of the unary function <tt class="literal"><span class="pre">f</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><p class="first"><tt class="literal"><span class="pre">operator*();</span></tt></p>
<table class="last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An object <tt class="literal"><span class="pre">r</span></tt> of unspecified type such that <tt class="literal"><span class="pre">r</span> <span class="pre">=</span> <span class="pre">t</span></tt>
is equivalent to <tt class="literal"><span class="pre">m_f(t)</span></tt> for all <tt class="literal"><span class="pre">t</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Remove:</dt>
<dd><p class="first"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</p>
<p><tt class="literal"><span class="pre">output_proxy(UnaryFunction&amp;</span> <span class="pre">f);</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">output_proxy</span></tt> with <tt class="literal"><span class="pre">f</span></tt> stored as
a data member.</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">output_proxy&amp;</span> <span class="pre">operator=(const</span> <span class="pre">T&amp;</span> <span class="pre">value);</span></tt></p>
<table class="last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><pre class="first last literal-block">
m_f(value); 
return *this; 
</pre>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>Change:</p>
<pre class="literal-block">
explicit function_output_iterator(const UnaryFunction&amp; f = UnaryFunction());
</pre>
<p>to:</p>
<pre class="literal-block">
explicit function_output_iterator();

explicit function_output_iterator(const UnaryFunction&amp; f);
</pre>
</div>
</div>
<div class="section" id="should-output-proxy-really-be-a-named-type">
<h2><a class="toc-backref" href="#id33" name="should-output-proxy-really-be-a-named-type">9.32 Should output_proxy really be a named type?</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>This means someone can store an output_proxy object for later use,
whatever that means. It also constrains output_proxy to hold a copy
of the function object, rather than a pointer to the iterator
object. Is all this mechanism really necessary?</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">See issue 9.31.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="istreambuf-iterator-isn-t-a-readable-iterator">
<h2><a class="toc-backref" href="#id34" name="istreambuf-iterator-isn-t-a-readable-iterator">9.33 istreambuf_iterator isn't a Readable Iterator</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12333:</p>
<blockquote>
N1550 requires that for a Readable Iterator a of type X, <tt class="literal"><span class="pre">*a</span></tt>
returns an object of type
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt>. <tt class="literal"><span class="pre">istreambuf_iterator::operator*</span></tt>
returns <tt class="literal"><span class="pre">charT</span></tt>, but <tt class="literal"><span class="pre">istreambuf_iterator::reference</span></tt> is
<tt class="literal"><span class="pre">charT&amp;</span></tt>. So am I overlooking something, or is
<tt class="literal"><span class="pre">istreambuf_iterator</span></tt> not Readable.</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Remove all constraints on
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt> in Readable Iterator and Lvalue
Iterator. Change Lvalue Iterator to refer to <tt class="literal"><span class="pre">T&amp;</span></tt> instead of
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt>.</p>
<dl>
<dt>Change:</dt>
<dd>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Readable Iterator</em>
concept for the value type <tt class="literal"><span class="pre">T</span></tt> if the following expressions
are valid and respect the stated semantics. <tt class="literal"><span class="pre">U</span></tt> is the type
of any specified member of type <tt class="literal"><span class="pre">T</span></tt>.</dd>
<dt>to:</dt>
<dd>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Readable Iterator</em>
concept for value type <tt class="literal"><span class="pre">T</span></tt> if, in addition to <tt class="literal"><span class="pre">X</span></tt> being
Assignable and Copy Constructible, the following expressions
are valid and respect the stated semantics. <tt class="literal"><span class="pre">U</span></tt> is the type
of any specified member of type <tt class="literal"><span class="pre">T</span></tt>.</dd>
</dl>
<p>From the Input Iterator Requirements table, remove:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="37%" />
<col width="37%" />
<col width="26%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt></td>
<td>Convertible to
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::value_type</span></tt></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="37%" />
<col width="37%" />
<col width="26%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">*a</span></tt></td>
<td><tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt></td>
<td>pre: <tt class="literal"><span class="pre">a</span></tt> is
dereferenceable. If <tt class="literal"><span class="pre">a</span>
<span class="pre">==</span> <span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt> is
equivalent to <tt class="literal"><span class="pre">*b</span></tt></td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="28%" />
<col width="20%" />
<col width="52%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">*a</span></tt></td>
<td>Convertible to <tt class="literal"><span class="pre">T</span></tt></td>
<td><dl class="first last">
<dt>pre: <tt class="literal"><span class="pre">a</span></tt> is dereferenceable. If <tt class="literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt></dt>
<dd>is equivalent to <tt class="literal"><span class="pre">*b</span></tt>.</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</blockquote>
<dl>
<dt>Change:</dt>
<dd>The <em>Lvalue Iterator</em> concept adds the requirement that the
<tt class="literal"><span class="pre">reference</span></tt> type be a reference to the value type of the
iterator.</dd>
<dt>to:</dt>
<dd>The <em>Lvalue Iterator</em> concept adds the requirement that the
return type of <tt class="literal"><span class="pre">operator*</span></tt> type be a reference to the value
type of the iterator.</dd>
</dl>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="42%" />
<col width="14%" />
<col width="44%" />
</colgroup>
<thead valign="bottom">
<tr><th colspan="3">Lvalue Iterator Requirements</th>
</tr>
<tr><th>Expression</th>
<th>Return Type</th>
<th>Assertion</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt></td>
<td><tt class="literal"><span class="pre">T&amp;</span></tt></td>
<td><tt class="literal"><span class="pre">T</span></tt> is <em>cv</em>
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::value_type</span></tt>
where <em>cv</em> is an optional
cv-qualification</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="22%" />
<col width="19%" />
<col width="59%" />
</colgroup>
<thead valign="bottom">
<tr><th colspan="3">Lvalue Iterator Requirements</th>
</tr>
<tr><th>Expression</th>
<th>Return Type</th>
<th>Note/Assertion</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">*a</span></tt></td>
<td><tt class="literal"><span class="pre">T&amp;</span></tt></td>
<td><tt class="literal"><span class="pre">T</span></tt> is <em>cv</em>
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::value_type</span></tt>
where <em>cv</em> is an optional
cv-qualification.
pre: <tt class="literal"><span class="pre">a</span></tt> is
dereferenceable. If <tt class="literal"><span class="pre">a</span>
<span class="pre">==</span> <span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt> is
equivalent to <tt class="literal"><span class="pre">*b</span></tt>.</td>
</tr>
</tbody>
</table>
</blockquote>
<p class="last">At the end of the section reverse_iterator models, add:
The type <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::reference</span></tt> must be the type of
<tt class="literal"><span class="pre">*i</span></tt>, where <tt class="literal"><span class="pre">i</span></tt> is an object of type <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body"><p class="first">Ideally there should be requirements on the reference
type, however, since Readable Iterator is suppose to correspond
to the current standard iterator requirements (which do not place
requirements on the reference type) we will leave them off for
now.  There is a DR in process with respect to the reference type
in the stadard iterator requirements. Once that is resolved we
will revisit this issue for Readable Iterator and Lvalue
Iterator.</p>
<p class="last">We added Assignable to the requirements for Readable
Iterator. This is needed to have Readable Iterator coincide with
the capabilities of Input Iterator.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-free-functions-unspecified">
<h2><a class="toc-backref" href="#id35" name="iterator-facade-free-functions-unspecified">9.34 iterator_facade free functions unspecified</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12562:</p>
<blockquote>
The template functions <tt class="literal"><span class="pre">operator==</span></tt>, <tt class="literal"><span class="pre">operator!=</span></tt>,
<tt class="literal"><span class="pre">operator&lt;</span></tt>, <tt class="literal"><span class="pre">operator&lt;=</span></tt>, <tt class="literal"><span class="pre">operator&gt;</span></tt>, <tt class="literal"><span class="pre">operator&gt;=</span></tt>, and
<tt class="literal"><span class="pre">operator-</span></tt> that take two arguments that are specializations of
iterator_facade have no specification. The template function
operator+ that takes an argument that is a specialization of
iterator_facade and an argument of type difference_type has no
specification.</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Add the missing specifications.</p>
<pre class="literal-block">
template &lt;class Dr, class V, class TC, class R, class D&gt;
Derived operator+ (iterator_facade&lt;Dr,V,TC,R,D&gt; const&amp;,
                   typename Derived::difference_type n);

template &lt;class Dr, class V, class TC, class R, class D&gt;
Derived operator+ (typename Derived::difference_type n,
                   iterator_facade&lt;Dr,V,TC,R,D&gt; const&amp;);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><pre class="first last literal-block">
Derived tmp(static_cast&lt;Derived const*&gt;(this));
return tmp += n;
</pre>
</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator ==(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">lhs.equal(rhs)</span></tt>.  Otherwise, <tt class="literal"><span class="pre">rhs.equal(lhs)</span></tt>.</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator !=(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">!lhs.equal(rhs)</span></tt>.  Otherwise, <tt class="literal"><span class="pre">!rhs.equal(lhs)</span></tt>.</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &lt;(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">lhs.distance_to(rhs)</span> <span class="pre">&lt;</span> <span class="pre">0</span></tt>. Otherwise, <tt class="literal"><span class="pre">rhs.distance_to(lhs)</span> <span class="pre">&gt;</span>
<span class="pre">0</span></tt>.</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &lt;=(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">lhs.distance_to(rhs)</span> <span class="pre">&lt;=</span> <span class="pre">0</span></tt>. Otherwise, <tt class="literal"><span class="pre">rhs.distance_to(lhs)</span>
<span class="pre">&gt;=</span> <span class="pre">0</span></tt>.</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &gt;(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">lhs.distance_to(rhs)</span> <span class="pre">&gt;</span> <span class="pre">0</span></tt>. Otherwise,
<tt class="literal"><span class="pre">rhs.distance_to(lhs)</span> <span class="pre">&lt;</span> <span class="pre">0</span></tt>.</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,bool&gt;::type
operator &gt;=(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
            iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">lhs.distance_to(rhs)</span> <span class="pre">&gt;=</span> <span class="pre">0</span></tt>. Otherwise,
<tt class="literal"><span class="pre">rhs.distance_to(lhs)</span> <span class="pre">&lt;=</span> <span class="pre">0</span></tt>.</td>
</tr>
</tbody>
</table>
<pre class="literal-block">
template &lt;class Dr1, class V1, class TC1, class R1, class D1,
          class Dr2, class V2, class TC2, class R2, class D2&gt;
typename enable_if_interoperable&lt;Dr1,Dr2,difference&gt;::type
operator -(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
           iterator_facade&lt;Dr2,V2,TC2,R2,D2&gt; const&amp; rhs);
</pre>
<table class="last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Return Type:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">difference</span></tt> shall be
<tt class="literal"><span class="pre">iterator_traits&lt;Dr1&gt;::difference_type</span></tt>.  Otherwise,
<tt class="literal"><span class="pre">difference</span></tt> shall be
<tt class="literal"><span class="pre">iterator_traits&lt;Dr2&gt;::difference_type</span></tt>.</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">-lhs.distance_to(rhs)</span></tt>. Otherwise,
<tt class="literal"><span class="pre">rhs.distance_to(lhs)</span></tt>.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-too-many-equals">
<h2><a class="toc-backref" href="#id36" name="iterator-facade-too-many-equals">9.35 iterator_facade: too many equals?</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12563:</p>
<blockquote>
<p>The table listing the functions required for types derived from
iterator_facade has two functions named equal and two named
distance_to:</p>
<pre class="literal-block">
c.equal(b)
c.equal(y)
c.distance_to(b)
c.distance_to(z)
</pre>
<p>where b and c are const objects of the derived type, y and z are
constant objects of certain iterator types that are interoperable
with the derived type.  Seems like the 'b' versions are
redundant: in both cases, the other version will take a 'b'. In
fact, iterator_adaptor is specified to use iterator_facade, but
does not provide the 'b' versions of these functions.</p>
<p>Are the 'b' versions needed?</p>
</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Remove the 'b' versions.</p>
<p>In <tt class="literal"><span class="pre">iterator_facade</span></tt> requirements, remove:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="19%" />
<col width="18%" />
<col width="36%" />
<col width="26%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">c.equal(b)</span></tt></td>
<td>convertible to bool</td>
<td>true iff <tt class="literal"><span class="pre">b</span></tt> and <tt class="literal"><span class="pre">c</span></tt> are
equivalent.</td>
<td>Single Pass Iterator</td>
</tr>
</tbody>
</table>
</blockquote>
<p>and remove:</p>
<blockquote class="last">
<table border="1" class="table">
<colgroup>
<col width="19%" />
<col width="18%" />
<col width="36%" />
<col width="26%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">c.distance_to(b)</span></tt></td>
<td>convertible to
X::difference_type</td>
<td>equivalent to <tt class="literal"><span class="pre">distance(c,</span> <span class="pre">b)</span></tt></td>
<td>Random Access Traversal
Iterator</td>
</tr>
</tbody>
</table>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="iterator-facade-function-requirements">
<h2><a class="toc-backref" href="#id37" name="iterator-facade-function-requirements">9.36 iterator_facade function requirements</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12636:</p>
<blockquote>
<p>The table that lists required functions for the derived type X
passed to iterator_facade lists, among others:</p>
<p>for a single pass iterator:</p>
<pre class="literal-block">
c.equal(b)
c.equal(y)
</pre>
<p>where b and c are const X objects, and y is a const object of a
single pass iterator that is interoperable with X. Since X is
interoperable with itself, c.equal(b) is redundant. There is a
difference in their descriptions, but its meaning isn't
clear. The first is &quot;true iff b and c are equivalent&quot;, and the
second is &quot;true iff c and y refer to the same position.&quot; Is there
a difference between the undefined term &quot;equivalent&quot; and &quot;refer
to the same position&quot;?</p>
<p>Similarly, for a random access traversal iterator:</p>
<pre class="literal-block">
c.distance_to(b)
c.distance_to(z)
</pre>
<p>where z is a constant object of a random access traversal
iterator that is interoperable with X.  Again, X is interoperable
with itself, so c.distance_to(b) is redundant.  Also, the
specification for c.distance_to(z) isn't valid. It's written
as &quot;equivalent to distance(c, z)&quot;. The template function distance
takes two arguments of the same type, so distance(c, z) isn't
valid if c and z are different types. Should it be
distance(c, (X)z)?</p>
</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Removed the 'b' versions (see 9.35) and added the cast.</p>
<p>Change:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="19%" />
<col width="18%" />
<col width="36%" />
<col width="26%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">c.distance_to(z)</span></tt></td>
<td>convertible to
X::difference_type</td>
<td>equivalent to <tt class="literal"><span class="pre">distance(c,</span> <span class="pre">z)</span></tt>.
Implements <tt class="literal"><span class="pre">c</span> <span class="pre">-</span> <span class="pre">z</span></tt>, <tt class="literal"><span class="pre">c</span> <span class="pre">&lt;</span> <span class="pre">z</span></tt>, <tt class="literal"><span class="pre">c</span>
<span class="pre">&lt;=</span> <span class="pre">z</span></tt>, <tt class="literal"><span class="pre">c</span> <span class="pre">&gt;</span> <span class="pre">z</span></tt>, and <tt class="literal"><span class="pre">c</span> <span class="pre">&gt;=</span> <span class="pre">c</span></tt>.</td>
<td>Random Access Traversal
Iterator</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote class="last">
<table border="1" class="table">
<colgroup>
<col width="21%" />
<col width="23%" />
<col width="27%" />
<col width="29%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">c.distance_to(z)</span></tt></td>
<td>convertible to
<tt class="literal"><span class="pre">F::difference_type</span></tt></td>
<td>equivalent to
<tt class="literal"><span class="pre">distance(c,</span> <span class="pre">X(z))</span></tt>.</td>
<td>Random Access Traversal
Iterator</td>
</tr>
</tbody>
</table>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="more-issues-not-from-matt-s-list">
<h1><a class="toc-backref" href="#id38" name="more-issues-not-from-matt-s-list">More Issues (not from Matt's list)</a></h1>
<div class="section" id="x-inheritance-in-iterator-adaptor-and-other-adaptors-is-an-overspecification">
<h2><a class="toc-backref" href="#id39" name="x-inheritance-in-iterator-adaptor-and-other-adaptors-is-an-overspecification">9.37x Inheritance in iterator_adaptor and other adaptors is an overspecification</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12696:
The paper requires that iterator_adaptor be derived from an
appropriate instance of iterator_facade, and that most of the specific
forms of adaptors be derived from appropriate instances of
iterator_adaptor. That seems like overspecification, and we ought to
look at specifying these things in terms of what the various templates
provide rather than how they're implemented.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Remove the specfication of inheritance, and add explicit
specification of all the functionality that was inherited from the
specialized iterators.</p>
<p>In iterator_adaptor, inheritance is retained, sorry NAD.  Also,
the Interoperable Iterators concept is added to the new iterator
concepts, and this concept is used in the specification of the
iterator adaptors.</p>
<p>In n1550, after [lib.random.access.traversal.iterators], add:</p>
<blockquote>
<p>Interoperable Iterators [lib.interoperable.iterators]</p>
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> that models Single Pass Iterator
is <em>interoperable with</em> a class or built-in type <tt class="literal"><span class="pre">Y</span></tt> that
also models Single Pass Iterator if the following expressions
are valid and respect the stated semantics. In the tables
below, <tt class="literal"><span class="pre">x</span></tt> is an object of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">y</span></tt> is an object of
type <tt class="literal"><span class="pre">Y</span></tt>, <tt class="literal"><span class="pre">Distance</span></tt> is
<tt class="literal"><span class="pre">iterator_traits&lt;Y&gt;::difference_type</span></tt>, and <tt class="literal"><span class="pre">n</span></tt> represents a
constant object of type <tt class="literal"><span class="pre">Distance</span></tt>.</p>
<table border="1" class="table">
<colgroup>
<col width="13%" />
<col width="27%" />
<col width="60%" />
</colgroup>
<thead valign="bottom">
<tr><th>Expression</th>
<th>Return Type</th>
<th>Assertion/Precondition/Postcondition</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">=</span> <span class="pre">x</span></tt></td>
<td><tt class="literal"><span class="pre">Y</span></tt></td>
<td>post: <tt class="literal"><span class="pre">y</span> <span class="pre">==</span> <span class="pre">x</span></tt></td>
</tr>
<tr><td><tt class="literal"><span class="pre">Y(x)</span></tt></td>
<td><tt class="literal"><span class="pre">Y</span></tt></td>
<td>post: <tt class="literal"><span class="pre">Y(x)</span> <span class="pre">==</span> <span class="pre">x</span></tt></td>
</tr>
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">y</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">==</span></tt> is an equivalence relation over its domain.</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">==</span> <span class="pre">x</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">==</span></tt> is an equivalence relation over its domain.</td>
</tr>
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">y</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">bool(a==b)</span> <span class="pre">!=</span> <span class="pre">bool(a!=b)</span></tt> over its domain.</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">!=</span> <span class="pre">x</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">bool(a==b)</span> <span class="pre">!=</span> <span class="pre">bool(a!=b)</span></tt> over its domain.</td>
</tr>
</tbody>
</table>
<p>If <tt class="literal"><span class="pre">X</span></tt> and <tt class="literal"><span class="pre">Y</span></tt> both model Random Access Traversal Iterator then
the following additional requirements must be met.</p>
<table border="1" class="table">
<colgroup>
<col width="12%" />
<col width="25%" />
<col width="23%" />
<col width="41%" />
</colgroup>
<thead valign="bottom">
<tr><th>Expression</th>
<th>Return Type</th>
<th>Operational Semantics</th>
<th>Assertion/ Precondition</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">&lt;</span> <span class="pre">y</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">y</span> <span class="pre">-</span> <span class="pre">x</span> <span class="pre">&gt;</span> <span class="pre">0</span></tt></td>
<td><tt class="literal"><span class="pre">&lt;</span></tt> is a total ordering relation</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">&lt;</span> <span class="pre">x</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">x</span> <span class="pre">-</span> <span class="pre">y</span> <span class="pre">&gt;</span> <span class="pre">0</span></tt></td>
<td><tt class="literal"><span class="pre">&lt;</span></tt> is a total ordering relation</td>
</tr>
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">&gt;</span> <span class="pre">y</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">y</span> <span class="pre">&lt;</span> <span class="pre">x</span></tt></td>
<td><tt class="literal"><span class="pre">&gt;</span></tt> is a total ordering relation</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">&gt;</span> <span class="pre">x</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">x</span> <span class="pre">&lt;</span> <span class="pre">y</span></tt></td>
<td><tt class="literal"><span class="pre">&gt;</span></tt> is a total ordering relation</td>
</tr>
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">&gt;=</span> <span class="pre">y</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">!(x</span> <span class="pre">&lt;</span> <span class="pre">y)</span></tt></td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">&gt;=</span> <span class="pre">x</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">!(y</span> <span class="pre">&lt;</span> <span class="pre">x)</span></tt></td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">&lt;=</span> <span class="pre">y</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">!(x</span> <span class="pre">&gt;</span> <span class="pre">y)</span></tt></td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">&lt;=</span> <span class="pre">x</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">!(y</span> <span class="pre">&gt;</span> <span class="pre">x)</span></tt></td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">-</span> <span class="pre">x</span></tt></td>
<td><tt class="literal"><span class="pre">Distance</span></tt></td>
<td><tt class="literal"><span class="pre">distance(Y(x),y)</span></tt></td>
<td>pre: there exists a value <tt class="literal"><span class="pre">n</span></tt> of
<tt class="literal"><span class="pre">Distance</span></tt> such that <tt class="literal"><span class="pre">x</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">y</span></tt>.
<tt class="literal"><span class="pre">y</span> <span class="pre">==</span> <span class="pre">x</span> <span class="pre">+</span> <span class="pre">(y</span> <span class="pre">-</span> <span class="pre">x)</span></tt>.</td>
</tr>
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">-</span> <span class="pre">y</span></tt></td>
<td><tt class="literal"><span class="pre">Distance</span></tt></td>
<td><tt class="literal"><span class="pre">distance(y,Y(x))</span></tt></td>
<td>pre: there exists a value <tt class="literal"><span class="pre">n</span></tt> of
<tt class="literal"><span class="pre">Distance</span></tt> such that <tt class="literal"><span class="pre">y</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">x</span></tt>.
<tt class="literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">y</span> <span class="pre">+</span> <span class="pre">(x</span> <span class="pre">-</span> <span class="pre">y)</span></tt>.</td>
</tr>
</tbody>
</table>
</blockquote>
<p>In N1530:</p>
<blockquote class="last">
<p>In [lib.iterator.adaptor]</p>
<p>Change:</p>
<pre class="literal-block">
class iterator_adaptor 
  : public iterator_facade&lt;Derived, /* see details ...*/&gt;
</pre>
<p>To:</p>
<pre class="literal-block">
class iterator_adaptor 
  : public iterator_facade&lt;Derived, *V'*, *C'*, *R'*, *D'*&gt; // see details
</pre>
<dl>
<dt>Change the text from:</dt>
<dd>The <tt class="literal"><span class="pre">Base</span></tt> type must implement the expressions involving
<tt class="literal"><span class="pre">m_iterator</span></tt> in the specifications...</dd>
<dt>until the end of the <strong>iterator_adaptor requirements</strong> section, to:</dt>
<dd>The <tt class="literal"><span class="pre">Base</span></tt> argument shall be Assignable and Copy Constructible.</dd>
</dl>
<p>Add:</p>
</blockquote>
</td>
</tr>
</tbody>
</table>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class parameters</p>
<blockquote>
<p>The <em>V'</em>, <em>C'</em>, <em>R'</em>, and <em>D'</em> parameters of the <tt class="literal"><span class="pre">iterator_facade</span></tt>
used as a base class in the summary of <tt class="literal"><span class="pre">iterator_adaptor</span></tt>
above are defined as follows:</p>
<pre class="literal-block">
<em>V'</em> = if (Value is use_default)
          return iterator_traits&lt;Base&gt;::value_type
      else
          return Value

<em>C'</em> = if (CategoryOrTraversal is use_default)
          return iterator_traversal&lt;Base&gt;::type
      else
          return CategoryOrTraversal

<em>R'</em> = if (Reference is use_default)
          if (Value is use_default)
              return iterator_traits&lt;Base&gt;::reference
          else
              return Value&amp;
      else
          return Reference

<em>D'</em> = if (Difference is use_default)
          return iterator_traits&lt;Base&gt;::difference_type
      else
          return Difference
</pre>
</blockquote>
<p>In [lib.iterator.special.adaptors]</p>
<p>Change:</p>
<pre class="literal-block">
class indirect_iterator
  : public iterator_adaptor&lt;/* see discussion */&gt;
{
    friend class iterator_core_access;
</pre>
<p>to:</p>
<pre class="literal-block">
class indirect_iterator
{
 public:
    typedef /* see below */ value_type;
    typedef /* see below */ reference;
    typedef /* see below */ pointer;
    typedef /* see below */ difference_type;
    typedef /* see below */ iterator_category;
</pre>
<p>Change:</p>
<pre class="literal-block">
private: // as-if specification
    typename indirect_iterator::reference dereference() const
    {
        return **this-&gt;base();
    }
</pre>
<p>to:</p>
<pre class="literal-block">
    Iterator const&amp; base() const;
    reference operator*() const;
    indirect_iterator&amp; operator++();
    indirect_iterator&amp; operator--();
private:
   Iterator m_iterator; // exposition
</pre>
<p>After the synopsis add:</p>
<blockquote>
<p>The member types of <tt class="literal"><span class="pre">indirect_iterator</span></tt> are defined
according to the following pseudo-code, where <tt class="literal"><span class="pre">V</span></tt> is
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt></p>
<pre class="literal-block">
if (Value is use_default) then
    typedef remove_const&lt;pointee&lt;V&gt;::type&gt;::type value_type;
else
    typedef remove_const&lt;Value&gt;::type value_type;

if (Reference is use_default) then
    if (Value is use_default) then
        typedef indirect_reference&lt;V&gt;::type reference;
    else
        typedef Value&amp; reference;
else
    typedef Reference reference;

if (Value is use_default) then 
    typedef pointee&lt;V&gt;::type* pointer;
else 
    typedef Value* pointer;

if (Difference is use_default)
    typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
else
    typedef Difference difference_type;

if (CategoryOrTraversal is use_default)
    typedef <em>iterator-category</em>(
        iterator_traversal&lt;Iterator&gt;::type,``reference``,``value_type``
    ) iterator_category;
else
    typedef <em>iterator-category</em>(
        CategoryOrTraversal,``reference``,``value_type``
    ) iterator_category;
</pre>
</blockquote>
<p>[Note: See resolution to 9.44y for a description of <tt class="literal"><span class="pre">pointee</span></tt> and
<tt class="literal"><span class="pre">indirect_reference</span></tt>]</p>
<p>After the requirements section, add:</p>
</div>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</p>
<blockquote>
<p>In addition to the concepts indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>
and by <tt class="literal"><span class="pre">iterator_traversal&lt;indirect_iterator&gt;::type</span></tt>, a
specialization of <tt class="literal"><span class="pre">indirect_iterator</span></tt> models the following
concepts, Where <tt class="literal"><span class="pre">v</span></tt> is an object of
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>:</p>
<blockquote>
<ul class="simple">
<li>Readable Iterator if <tt class="literal"><span class="pre">reference(*v)</span></tt> is convertible to
<tt class="literal"><span class="pre">value_type</span></tt>.</li>
<li>Writable Iterator if <tt class="literal"><span class="pre">reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid
expression (where <tt class="literal"><span class="pre">t</span></tt> is an object of type
<tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>)</li>
<li>Lvalue Iterator if <tt class="literal"><span class="pre">reference</span></tt> is a reference type.</li>
</ul>
</blockquote>
<p><tt class="literal"><span class="pre">indirect_iterator&lt;X,V1,C1,R1,D1&gt;</span></tt> is interoperable with
<tt class="literal"><span class="pre">indirect_iterator&lt;Y,V2,C2,R2,D2&gt;</span></tt> if and only if <tt class="literal"><span class="pre">X</span></tt> is
interoperable with <tt class="literal"><span class="pre">Y</span></tt>.</p>
</blockquote>
<p>Before <tt class="literal"><span class="pre">indirect_iterator();</span></tt> add:</p>
<blockquote>
In addition to the operations required by the concepts described
above, specializations of <tt class="literal"><span class="pre">indirect_iterator</span></tt> provide the
following operations.</blockquote>
<dl>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
the <tt class="literal"><span class="pre">iterator_adaptor</span></tt> subobject copy constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
<tt class="literal"><span class="pre">m_iterator</span></tt> copy constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>At the end of the indirect_iterator operations add:</p>
<blockquote>
<p><tt class="literal"><span class="pre">Iterator</span> <span class="pre">const&amp;</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_iterator</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">reference</span> <span class="pre">operator*()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">**m_iterator</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">indirect_iterator&amp;</span> <span class="pre">operator++();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">++m_iterator</span></tt></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">indirect_iterator&amp;</span> <span class="pre">operator--();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">--m_iterator</span></tt></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<pre class="literal-block">
template &lt;class Iterator&gt;
class reverse_iterator :
  public iterator_adaptor&lt; reverse_iterator&lt;Iterator&gt;, Iterator &gt;
{
  friend class iterator_core_access;
</pre>
<p>to:</p>
<pre class="literal-block">
template &lt;class Iterator&gt;
class reverse_iterator
{
public:
  typedef iterator_traits&lt;Iterator&gt;::value_type value_type;
  typedef iterator_traits&lt;Iterator&gt;::reference reference;
  typedef iterator_traits&lt;Iterator&gt;::pointer pointer;
  typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
  typedef /* see below */ iterator_category;
</pre>
<p>Change:</p>
<pre class="literal-block">
private: // as-if specification
  typename reverse_iterator::reference dereference() const { return *prior(this-&gt;base()); }

  void increment() { --this-&gt;base_reference(); }
  void decrement() { ++this-&gt;base_reference(); }

  void advance(typename reverse_iterator::difference_type n)
  {
      this-&gt;base_reference() += -n;
  }

  template &lt;class OtherIterator&gt;
  typename reverse_iterator::difference_type
  distance_to(reverse_iterator&lt;OtherIterator&gt; const&amp; y) const
  {
      return this-&gt;base_reference() - y.base();
  }
</pre>
<p>to:</p>
<pre class="literal-block">
  Iterator const&amp; base() const;
  reference operator*() const;
  reverse_iterator&amp; operator++();
  reverse_iterator&amp; operator--();
private:
  Iterator m_iterator; // exposition
</pre>
<dl>
<dt>After the synopsis for <tt class="literal"><span class="pre">reverse_iterator</span></tt>, add:</dt>
<dd>If <tt class="literal"><span class="pre">Iterator</span></tt> models Random Access Traversal Iterator and Readable
Lvalue Iterator, then <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
<tt class="literal"><span class="pre">random_access_iterator_tag</span></tt>. Otherwise, if
<tt class="literal"><span class="pre">Iterator</span></tt> models Bidirectional Traversal Iterator and Readable
Lvalue Iterator, then <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
<tt class="literal"><span class="pre">bidirectional_iterator_tag</span></tt>. Otherwise, <tt class="literal"><span class="pre">iterator_category</span></tt> is
convertible to <tt class="literal"><span class="pre">input_iterator_tag</span></tt>.</dd>
<dt>Change:</dt>
<dd><p class="first"><strong>reverse_iterator requirements</strong></p>
<p class="last">The base <tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal
Iterator. The resulting <tt class="literal"><span class="pre">reverse_iterator</span></tt> will be a model of the
most refined standard traversal and access concepts that are modeled
by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
</dd>
<dt>to:</dt>
<dd><p class="first"><strong>reverse_iterator requirements</strong></p>
<p class="last"><tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal Iterator.</p>
</dd>
</dl>
</div>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</p>
<blockquote>
<p>A specialization of <tt class="literal"><span class="pre">reverse_iterator</span></tt> models the same iterator
traversal and iterator access concepts modeled by its <tt class="literal"><span class="pre">Iterator</span></tt>
argument.  In addition, it may model old iterator concepts
specified in the following table:</p>
<table border="1" class="table">
<colgroup>
<col width="53%" />
<col width="47%" />
</colgroup>
<thead valign="bottom">
<tr><th>If <tt class="literal"><span class="pre">I</span></tt> models</th>
<th>then <tt class="literal"><span class="pre">reverse_iterator&lt;I&gt;</span></tt> models</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Readable Lvalue Iterator,
Bidirectional Traversal Iterator</td>
<td>Bidirectional Iterator</td>
</tr>
<tr><td>Writable Lvalue Iterator,
Bidirectional Traversal Iterator</td>
<td>Mutable Bidirectional Iterator</td>
</tr>
<tr><td>Readable Lvalue Iterator,
Random Access Traversal Iterator</td>
<td>Random Access Iterator</td>
</tr>
<tr><td>Writable Lvalue Iterator,
Random Access Traversal Iterator</td>
<td>Mutable Random Access Iterator</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">reverse_iterator&lt;X&gt;</span></tt> is interoperable with
<tt class="literal"><span class="pre">reverse_iterator&lt;Y&gt;</span></tt> if and only if <tt class="literal"><span class="pre">X</span></tt> is interoperable with
<tt class="literal"><span class="pre">Y</span></tt>.</p>
</blockquote>
<dl>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with a
default constructed base object.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs an instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with <tt class="literal"><span class="pre">m_iterator</span></tt> 
default constructed.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs an instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with a
base object copy constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs an instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with a
<tt class="literal"><span class="pre">m_iterator</span></tt> constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> that is a copy of <tt class="literal"><span class="pre">r</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> whose 
<tt class="literal"><span class="pre">m_iterator</span></tt> subobject is constructed from <tt class="literal"><span class="pre">y.base()</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>At the end of the operations for <tt class="literal"><span class="pre">reverse_iterator</span></tt>, add:</dt>
<dd><p class="first"><tt class="literal"><span class="pre">Iterator</span> <span class="pre">const&amp;</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_iterator</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">reference</span> <span class="pre">operator*()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<pre class="literal-block">
Iterator tmp = m_iterator;
return *--tmp;
</pre>
<p><tt class="literal"><span class="pre">reverse_iterator&amp;</span> <span class="pre">operator++();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">--m_iterator</span></tt></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">reverse_iterator&amp;</span> <span class="pre">operator--();</span></tt></p>
<table class="last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">++m_iterator</span></tt></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>Change:</p>
<pre class="literal-block">
class transform_iterator
  : public iterator_adaptor&lt;/* see discussion */&gt;
{
  friend class iterator_core_access;
</pre>
<p>to:</p>
<pre class="literal-block">
class transform_iterator
{
public:
  typedef /* see below */ value_type;
  typedef /* see below */ reference;
  typedef /* see below */ pointer;
  typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
  typedef /* see below */ iterator_category;
</pre>
<p>After <tt class="literal"><span class="pre">UnaryFunction</span> <span class="pre">functor()</span> <span class="pre">const;</span></tt> add:</p>
<pre class="literal-block">
Iterator const&amp; base() const;
reference operator*() const;
transform_iterator&amp; operator++();
transform_iterator&amp; operator--();
</pre>
<p>Change:</p>
<pre class="literal-block">
private:
  typename transform_iterator::value_type dereference() const;
  UnaryFunction m_f;
};
</pre>
<p>to:</p>
<pre class="literal-block">
private:
  Iterator m_iterator; // exposition only
  UnaryFunction m_f;   // exposition only
};
</pre>
<dl>
<dt>After the synopsis, add:</dt>
<dd>If <tt class="literal"><span class="pre">Iterator</span></tt> models Readable Lvalue Iterator and if <tt class="literal"><span class="pre">Iterator</span></tt>
models Random Access Traversal Iterator, then <tt class="literal"><span class="pre">iterator_category</span></tt> is
convertible to <tt class="literal"><span class="pre">random_access_iterator_tag</span></tt>. Otherwise, if
<tt class="literal"><span class="pre">Iterator</span></tt> models Bidirectional Traversal Iterator, then
<tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
<tt class="literal"><span class="pre">bidirectional_iterator_tag</span></tt>.  Otherwise <tt class="literal"><span class="pre">iterator_category</span></tt> is
convertible to <tt class="literal"><span class="pre">forward_iterator_tag</span></tt>. If <tt class="literal"><span class="pre">Iterator</span></tt> does not
model Readable Lvalue Iterator then <tt class="literal"><span class="pre">iterator_category</span></tt> is
convertible to <tt class="literal"><span class="pre">input_iterator_tag</span></tt>.</dd>
<dt>In the requirements section, change:</dt>
<dd><p class="first">The type <tt class="literal"><span class="pre">Iterator</span></tt> must at least model Readable Iterator.  The
resulting <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined of the
following that is also modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
<blockquote>
<ul class="simple">
<li>Writable Lvalue Iterator if
<tt class="literal"><span class="pre">result_of&lt;UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)&gt;::type</span></tt>
is a non-const reference.</li>
<li>Readable Lvalue Iterator if
<tt class="literal"><span class="pre">result_of&lt;UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)&gt;::type</span></tt>
is a const reference.</li>
<li>Readable Iterator otherwise.</li>
</ul>
</blockquote>
<p>The <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined standard traversal
concept that is modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
<p class="last">The <tt class="literal"><span class="pre">reference</span></tt> type of <tt class="literal"><span class="pre">transform_iterator</span></tt> is
<tt class="literal"><span class="pre">result_of&lt;UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)&gt;::type</span></tt>.
The <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">remove_cv&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</p>
</dd>
<dt>to:</dt>
<dd>The argument <tt class="literal"><span class="pre">Iterator</span></tt> shall model Readable Iterator.</dd>
</dl>
<p>After the requirements section, add:</p>
</div>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</p>
<blockquote>
<p>The resulting <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined of the
following options that is also modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
<blockquote>
<ul class="simple">
<li>Writable Lvalue Iterator if
<tt class="literal"><span class="pre">transform_iterator::reference</span></tt> is a non-const
reference.</li>
<li>Readable Lvalue Iterator if
<tt class="literal"><span class="pre">transform_iterator::reference</span></tt> is a const reference.</li>
<li>Readable Iterator otherwise.</li>
</ul>
</blockquote>
<p>The <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined standard traversal
concept that is modeled by the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
<p>If <tt class="literal"><span class="pre">transform_iterator</span></tt> is a model of Readable Lvalue Iterator then
it models the following original iterator concepts depending on what
the <tt class="literal"><span class="pre">Iterator</span></tt> argument models.</p>
<table border="1" class="table">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
<th>then <tt class="literal"><span class="pre">transform_iterator</span></tt> models</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Single Pass Iterator</td>
<td>Input Iterator</td>
</tr>
<tr><td>Forward Traversal Iterator</td>
<td>Forward Iterator</td>
</tr>
<tr><td>Bidirectional Traversal Iterator</td>
<td>Bidirectional Iterator</td>
</tr>
<tr><td>Random Access Traversal Iterator</td>
<td>Random Access Iterator</td>
</tr>
</tbody>
</table>
<p>If <tt class="literal"><span class="pre">transform_iterator</span></tt> models Writable Lvalue Iterator then it is a
mutable iterator (as defined in the old iterator requirements).</p>
<p><tt class="literal"><span class="pre">transform_iterator&lt;F1,</span> <span class="pre">X,</span> <span class="pre">R1,</span> <span class="pre">V1&gt;</span></tt> is interoperable with
<tt class="literal"><span class="pre">transform_iterator&lt;F2,</span> <span class="pre">Y,</span> <span class="pre">R2,</span> <span class="pre">V2&gt;</span></tt> if and only if <tt class="literal"><span class="pre">X</span></tt> is
interoperable with <tt class="literal"><span class="pre">Y</span></tt>.</p>
</blockquote>
<p>Remove the private operations section heading and remove:</p>
<pre class="literal-block">
``typename transform_iterator::value_type dereference() const;``

:Returns: ``m_f(transform_iterator::dereference());``
</pre>
<p>After the entry for <tt class="literal"><span class="pre">functor()</span></tt>, add:</p>
<pre class="literal-block">
``Iterator const&amp; base() const;``

:Returns: ``m_iterator``


``reference operator*() const;``

:Returns: ``m_f(*m_iterator)``


``transform_iterator&amp; operator++();``

:Effects: ``++m_iterator``
:Returns: ``*this``


``transform_iterator&amp; operator--();``

:Effects: ``--m_iterator``
:Returns: ``*this``
</pre>
<p>Change:</p>
<pre class="literal-block">
template &lt;class Predicate, class Iterator&gt;
class filter_iterator
   : public iterator_adaptor&lt;
         filter_iterator&lt;Predicate, Iterator&gt;, Iterator
       , use_default
       , /* see details */
     &gt;
{
 public:
</pre>
<p>to:</p>
<pre class="literal-block">
template &lt;class Predicate, class Iterator&gt;
class filter_iterator
{
 public:
   typedef iterator_traits&lt;Iterator&gt;::value_type value_type;
   typedef iterator_traits&lt;Iterator&gt;::reference reference;
   typedef iterator_traits&lt;Iterator&gt;::pointer pointer;
   typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
   typedef /* see below */ iterator_category;
</pre>
<p>Change:</p>
<pre class="literal-block">
private: // as-if specification
   void increment()
   {
       ++(this-&gt;base_reference());
       satisfy_predicate();
   }

   void satisfy_predicate()
   {
       while (this-&gt;base() != this-&gt;m_end &amp;&amp; !this-&gt;m_predicate(*this-&gt;base()))
           ++(this-&gt;base_reference());
   }

   Predicate m_predicate;
   Iterator m_end;
</pre>
<p>to:</p>
<pre class="literal-block">
    Iterator const&amp; base() const;
    reference operator*() const;
    filter_iterator&amp; operator++();
private:
    Predicate m_pred; // exposition only
    Iterator m_iter;  // exposition only
    Iterator m_end;   // exposition only
</pre>
<dl>
<dt>Change:</dt>
<dd>The base <tt class="literal"><span class="pre">Iterator</span></tt> parameter must be a model of Readable
Iterator and Single Pass Iterator. The resulting
<tt class="literal"><span class="pre">filter_iterator</span></tt> will be a model of Forward Traversal Iterator
if <tt class="literal"><span class="pre">Iterator</span></tt> is, otherwise the <tt class="literal"><span class="pre">filter_iterator</span></tt> will be a
model of Single Pass Iterator. The access category of the
<tt class="literal"><span class="pre">filter_iterator</span></tt> will be the same as the access category of
<tt class="literal"><span class="pre">Iterator</span></tt>.</dd>
<dt>to:</dt>
<dd>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable
Iterator and Single Pass Iterator or it shall meet the requirements of
Input Iterator.</dd>
</dl>
<p>After the requirements section, add:</p>
</div>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</p>
<blockquote>
<p>The concepts that <tt class="literal"><span class="pre">filter_iterator</span></tt> models are dependent on which
concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the
following tables.</p>
<table border="1" class="table">
<colgroup>
<col width="33%" />
<col width="67%" />
</colgroup>
<thead valign="bottom">
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Single Pass Iterator</td>
<td>Single Pass Iterator</td>
</tr>
<tr><td>Forward Traversal Iterator</td>
<td>Forward Traversal Iterator</td>
</tr>
</tbody>
</table>
<table border="1" class="table">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<thead valign="bottom">
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Readable Iterator</td>
<td>Readable Iterator</td>
</tr>
<tr><td>Writable Iterator</td>
<td>Writable Iterator</td>
</tr>
<tr><td>Lvalue Iterator</td>
<td>Lvalue Iterator</td>
</tr>
</tbody>
</table>
<table border="1" class="table">
<colgroup>
<col width="63%" />
<col width="38%" />
</colgroup>
<thead valign="bottom">
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Readable Iterator, Single Pass Iterator</td>
<td>Input Iterator</td>
</tr>
<tr><td>Readable Lvalue Iterator, Forward Traversal Iterator</td>
<td>Forward Iterator</td>
</tr>
<tr><td>Writable Lvalue Iterator, Forward Traversal Iterator</td>
<td>Mutable Forward Iterator</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">filter_iterator&lt;P1,</span> <span class="pre">X&gt;</span></tt> is interoperable with <tt class="literal"><span class="pre">filter_iterator&lt;P2,</span> <span class="pre">Y&gt;</span></tt> 
if and only if <tt class="literal"><span class="pre">X</span></tt> is interoperable with <tt class="literal"><span class="pre">Y</span></tt>.</p>
</blockquote>
<dl>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <tt class="literal"><span class="pre">filter_iterator</span></tt> whose
predicate is a default constructed <tt class="literal"><span class="pre">Predicate</span></tt> and
whose <tt class="literal"><span class="pre">end</span></tt> is a default constructed <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs a <tt class="literal"><span class="pre">filter_iterator</span></tt> whose``m_pred``,  <tt class="literal"><span class="pre">m_iter</span></tt>, and <tt class="literal"><span class="pre">m_end</span></tt> 
members are a default constructed.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> at position <tt class="literal"><span class="pre">x</span></tt> that filters according
to predicate <tt class="literal"><span class="pre">f</span></tt> and that will not increment past <tt class="literal"><span class="pre">end</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs a <tt class="literal"><span class="pre">filter_iterator</span></tt> where <tt class="literal"><span class="pre">m_iter</span></tt> is either
the first position in the range <tt class="literal"><span class="pre">[x,end)</span></tt> such that <tt class="literal"><span class="pre">f(*m_iter)</span> <span class="pre">==</span> <span class="pre">true</span></tt> 
or else``m_iter == end``. The member <tt class="literal"><span class="pre">m_pred</span></tt> is constructed from
<tt class="literal"><span class="pre">f</span></tt> and <tt class="literal"><span class="pre">m_end</span></tt> from <tt class="literal"><span class="pre">end</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> at position <tt class="literal"><span class="pre">x</span></tt> that filters 
according to a default constructed <tt class="literal"><span class="pre">Predicate</span></tt>
and that will not increment past <tt class="literal"><span class="pre">end</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs a <tt class="literal"><span class="pre">filter_iterator</span></tt> where <tt class="literal"><span class="pre">m_iter</span></tt> is either
the first position in the range <tt class="literal"><span class="pre">[x,end)</span></tt> such that <tt class="literal"><span class="pre">m_pred(*m_iter)</span> <span class="pre">==</span> <span class="pre">true</span></tt> 
or else``m_iter == end``. The member <tt class="literal"><span class="pre">m_pred</span></tt> is default constructed.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A copy of iterator <tt class="literal"><span class="pre">t</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Constructs a filter iterator whose members are copied from <tt class="literal"><span class="pre">t</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A copy of the predicate object used to construct <tt class="literal"><span class="pre">*this</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_pred</span></tt></td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">The object <tt class="literal"><span class="pre">end</span></tt> used to construct <tt class="literal"><span class="pre">*this</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_end</span></tt></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>At the end of the operations section, add:</p>
<blockquote>
<p><tt class="literal"><span class="pre">reference</span> <span class="pre">operator*()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*m_iter</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">filter_iterator&amp;</span> <span class="pre">operator++();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Increments <tt class="literal"><span class="pre">m_iter</span></tt> and then continues to
increment <tt class="literal"><span class="pre">m_iter</span></tt> until either <tt class="literal"><span class="pre">m_iter</span> <span class="pre">==</span> <span class="pre">m_end</span></tt>
or <tt class="literal"><span class="pre">m_pred(*m_iter)</span> <span class="pre">==</span> <span class="pre">true</span></tt>.</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
</blockquote>
<p>Change:</p>
<pre class="literal-block">
class counting_iterator
  : public iterator_adaptor&lt;
        counting_iterator&lt;Incrementable, Access, Traversal, Difference&gt;
      , Incrementable
      , Incrementable
      , Access
      , /* see details for traversal category */
      , Incrementable const&amp;
      , Incrementable const*
      , /* distance = Difference or a signed integral type */&gt;
{
    friend class iterator_core_access;
 public:
</pre>
<p>to:</p>
<pre class="literal-block">
class counting_iterator
{
 public:
    typedef Incrementable value_type;
    typedef const Incrementable&amp; reference;
    typedef const Incrementable* pointer;
    typedef /* see below */ difference_type;
    typedef /* see below */ iterator_category;
</pre>
<p>Change:</p>
<pre class="literal-block">
private:
    typename counting_iterator::reference dereference() const
    {
        return this-&gt;base_reference();
    }
</pre>
<p>to:</p>
<pre class="literal-block">
    Incrementable const&amp; base() const;
    reference operator*() const;
    counting_iterator&amp; operator++();
    counting_iterator&amp; operator--();
private:
    Incrementable m_inc; // exposition
</pre>
<p>After the synopsis, add:</p>
<blockquote>
<p>If the <tt class="literal"><span class="pre">Difference</span></tt> argument is <tt class="literal"><span class="pre">use_default</span></tt> then
<tt class="literal"><span class="pre">difference_type</span></tt> is an unspecified signed integral
type. Otherwise <tt class="literal"><span class="pre">difference_type</span></tt> is <tt class="literal"><span class="pre">Difference</span></tt>.</p>
<p><tt class="literal"><span class="pre">iterator_category</span></tt> is determined according to the following
algorithm:</p>
<pre class="literal-block">
if (CategoryOrTraversal is not use_default)
    return CategoryOrTraversal
else if (numeric_limits&lt;Incrementable&gt;::is_specialized)
    return <em>iterator-category</em>(
        random_access_traversal_tag, Incrementable, const Incrementable&amp;)
else
    return <em>iterator-category</em>(
         iterator_traversal&lt;Incrementable&gt;::type, 
         Incrementable, const Incrementable&amp;)
</pre>
</blockquote>
<dl>
<dt>Change:</dt>
<dd><dl class="first last">
<dt>[<em>Note:</em> implementers are encouraged to provide an implementation of</dt>
<dd><tt class="literal"><span class="pre">distance_to</span></tt> and a <tt class="literal"><span class="pre">difference_type</span></tt> that avoids overflows in
the cases when the <tt class="literal"><span class="pre">Incrementable</span></tt> type is a numeric type.]</dd>
</dl>
</dd>
<dt>to:</dt>
<dd><dl class="first last">
<dt>[<em>Note:</em> implementers are encouraged to provide an implementation of</dt>
<dd><tt class="literal"><span class="pre">operator-</span></tt> and a <tt class="literal"><span class="pre">difference_type</span></tt> that avoid overflows in
the cases where <tt class="literal"><span class="pre">std::numeric_limits&lt;Incrementable&gt;::is_specialized</span></tt>
is true.]</dd>
</dl>
</dd>
<dt>Change:</dt>
<dd><p class="first">The <tt class="literal"><span class="pre">Incrementable</span></tt> type must be Default Constructible, Copy
Constructible, and Assignable.  The default distance is
an implementation defined signed integegral type.</p>
<p class="last">The resulting <tt class="literal"><span class="pre">counting_iterator</span></tt> models Readable Lvalue Iterator.</p>
</dd>
<dt>to:</dt>
<dd>The <tt class="literal"><span class="pre">Incrementable</span></tt> argument shall be Copy Constructible and Assignable.</dd>
<dt>Change:</dt>
<dd>Furthermore, if you wish to create a counting iterator that is a Forward
Traversal Iterator, then the following expressions must be valid:</dd>
<dt>to:</dt>
<dd>If <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to <tt class="literal"><span class="pre">forward_iterator_tag</span></tt>
or <tt class="literal"><span class="pre">forward_traversal_tag</span></tt>, the following must be well-formed:</dd>
<dt>Change:</dt>
<dd>If you wish to create a counting iterator that is a 
Bidirectional Traversal Iterator, then pre-decrement is also required:</dd>
<dt>to:</dt>
<dd>If <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
<tt class="literal"><span class="pre">bidirectional_iterator_tag</span></tt> or <tt class="literal"><span class="pre">bidirectional_traversal_tag</span></tt>,
the following expression must also be well-formed:</dd>
<dt>Change:</dt>
<dd>If you wish to create a counting iterator that is a Random Access
Traversal Iterator, then these additional expressions are also
required:</dd>
<dt>to:</dt>
<dd>If <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
<tt class="literal"><span class="pre">random_access_iterator_tag</span></tt> or <tt class="literal"><span class="pre">random_access_traversal_tag</span></tt>,
the following must must also be valid:</dd>
</dl>
<p>After the requirements section, add:</p>
</div>
<div class="topic">
<p class="topic-title first"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</p>
<blockquote>
<p>Specializations of <tt class="literal"><span class="pre">counting_iterator</span></tt> model Readable Lvalue
Iterator. In addition, they model the concepts corresponding to the
iterator tags to which their <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible.
Also, if <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is not <tt class="literal"><span class="pre">use_default</span></tt> then
<tt class="literal"><span class="pre">counting_iterator</span></tt> models the concept corresponding to the iterator
tag <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>.  Otherwise, if
<tt class="literal"><span class="pre">numeric_limits&lt;Incrementable&gt;::is_specialized</span></tt>, then
<tt class="literal"><span class="pre">counting_iterator</span></tt> models Random Access Traversal Iterator.
Otherwise, <tt class="literal"><span class="pre">counting_iterator</span></tt> models the same iterator traversal
concepts modeled by <tt class="literal"><span class="pre">Incrementable</span></tt>.</p>
<p><tt class="literal"><span class="pre">counting_iterator&lt;X,C1,D1&gt;</span></tt> is interoperable with
<tt class="literal"><span class="pre">counting_iterator&lt;Y,C2,D2&gt;</span></tt> if and only if <tt class="literal"><span class="pre">X</span></tt> is
interoperable with <tt class="literal"><span class="pre">Y</span></tt>.</p>
</blockquote>
<p>At the begining of the operations section, add:</p>
<blockquote>
In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">counting_iterator</span></tt>, <tt class="literal"><span class="pre">counting_iterator</span></tt> provides the following
operations.</blockquote>
<dl>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A default constructed instance of <tt class="literal"><span class="pre">counting_iterator</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Incrementable</span></tt> is Default Constructible.</td>
</tr>
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Default construct the member <tt class="literal"><span class="pre">m_inc</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">counting_iterator</span></tt> that is a copy of <tt class="literal"><span class="pre">rhs</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Construct member <tt class="literal"><span class="pre">m_inc</span></tt> from <tt class="literal"><span class="pre">rhs.m_inc</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>Change:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">counting_iterator</span></tt> with its base
object copy constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
<dt>to:</dt>
<dd><table class="first last field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Construct member <tt class="literal"><span class="pre">m_inc</span></tt> from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>At the end of the operations section, add:</p>
<blockquote>
<p><tt class="literal"><span class="pre">reference</span> <span class="pre">operator*()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_inc</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">counting_iterator&amp;</span> <span class="pre">operator++();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">++m_inc</span></tt></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">counting_iterator&amp;</span> <span class="pre">operator--();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">--m_inc</span></tt></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">Incrementable</span> <span class="pre">const&amp;</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_inc</span></tt></td>
</tr>
</tbody>
</table>
</blockquote>
</div>
</div>
<div class="section" id="x-problem-with-specification-of-a-m-in-readable-iterator">
<h2><a class="toc-backref" href="#id40" name="x-problem-with-specification-of-a-m-in-readable-iterator">9.38x Problem with specification of a-&gt;m in Readable Iterator</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Howard Hinnant</td>
</tr>
<tr class="field"><th class="field-name">Status:</th><td class="field-body">New</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12585:</p>
<p>Readable Iterator Requirements says:</p>
<blockquote>
<table border="1" class="table">
<colgroup>
<col width="13%" />
<col width="10%" />
<col width="77%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">a-&gt;m</span></tt></td>
<td><tt class="literal"><span class="pre">U&amp;</span></tt></td>
<td>pre: <tt class="literal"><span class="pre">(*a).m</span></tt> is well-defined. Equivalent to <tt class="literal"><span class="pre">(*a).m</span></tt></td>
</tr>
</tbody>
</table>
</blockquote>
<p>Do we mean to outlaw iterators with proxy references from meeting
the readable requirements?</p>
<p>Would it be better for the requirements to read <tt class="literal"><span class="pre">static_cast&lt;T&gt;(*a).m</span></tt>
instead of <tt class="literal"><span class="pre">(*a).m</span></tt> ?</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">NAD.</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body"><p class="first">We think you're misreading &quot;pre:&quot;.
If <tt class="literal"><span class="pre">(*a).m</span></tt> is not well defined, then the iterator is not
required to provide <tt class="literal"><span class="pre">a-&gt;m</span></tt>. So a proxy iterator is not
required to provide <tt class="literal"><span class="pre">a-&gt;m</span></tt>.</p>
<p class="last">As an aside, it is possible for proxy iterators to
support <tt class="literal"><span class="pre">-&gt;</span></tt>, so changing the requirements to
read <tt class="literal"><span class="pre">static_cast&lt;T&gt;(*a).m</span></tt> is interesting.
However, such a change to Readable Iterator would
mean that it no longer corresponds to the
input iterator requirements. So old iterators would not
necessarily conform to new iterator requirements.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-counting-iterator-traversal-argument-unspecified">
<h2><a class="toc-backref" href="#id41" name="x-counting-iterator-traversal-argument-unspecified">9.39x counting_iterator Traversal argument unspecified</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12635:</p>
<p>counting_iterator takes an argument for its Traversal type, with a
default value of use_default. It is derived from an instance of
iterator_adaptor, where the argument passed for the Traversal type
is described as &quot;<tt class="literal"><span class="pre">/*</span> <span class="pre">see</span> <span class="pre">details</span> <span class="pre">for</span> <span class="pre">traversal</span> <span class="pre">category</span>
<span class="pre">*/</span></tt>&quot;. The details for counting_iterator describe constraints on
the Incrementable type imposed by various traversal
categories. There is no description of what the argument to
iterator_adaptor should be.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">We no longer inherit from iterator_adaptor. So instead,
we specify the iterator_category in terms of the Traversal type
(which is now called CategoryOrTraversal). Also the
requirements and models section was reorganized to
match these changes and to make more sense.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-indirect-iterator-requirements-muddled">
<h2><a class="toc-backref" href="#id42" name="x-indirect-iterator-requirements-muddled">9.40x indirect_iterator requirements muddled</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12640:</p>
<blockquote>
<blockquote>
The value_type of the Iterator template parameter should itself
be dereferenceable. The return type of the <tt class="literal"><span class="pre">operator*</span></tt> for
the value_type must be the same type as the Reference template
parameter.</blockquote>
<p>I'd say this a bit differently, to emphasize what's required:
iterator_traits&lt;Iterator&gt;::value_type must be dereferenceable.
The Reference template parameter must be the same type as 
<tt class="literal"><span class="pre">*iterator_traits&lt;Iterator&gt;::value_type()</span></tt>.</p>
<blockquote>
The Value template parameter will be the value_type for the 
indirect_iterator, unless Value is const. If Value is const X, then 
value_type will be non- const X.</blockquote>
<p>Also non-volatile, right? In other words, if Value isn't use_default, it 
just gets passed as the Value argument for iterator_adaptor.</p>
<blockquote>
<p>The default for Value is:</p>
<pre class="literal-block">
iterator_traits&lt; iterator_traits&lt;Iterator&gt;::value_type &gt;::value_type
</pre>
<p>If the default is used for Value, then there must be a valid
specialization of iterator_traits for the value type of the
base iterator.</p>
</blockquote>
<p>The earlier requirement is that
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> must be
dereferenceable. Now it's being treated as an iterator. Is this
just a pun, or is <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>
required to be some form of iterator? If it's the former we need
to find a different way to say it.  If it's the latter we need to
say so.</p>
</blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<blockquote>
<p>The <tt class="literal"><span class="pre">value_type</span></tt> of the <tt class="literal"><span class="pre">Iterator</span></tt> template parameter
should itself be dereferenceable. The return type of the
<tt class="literal"><span class="pre">operator*</span></tt> for the <tt class="literal"><span class="pre">value_type</span></tt> must be the same type as
the <tt class="literal"><span class="pre">Reference</span></tt> template parameter. The <tt class="literal"><span class="pre">Value</span></tt> template
parameter will be the <tt class="literal"><span class="pre">value_type</span></tt> for the
<tt class="literal"><span class="pre">indirect_iterator</span></tt>, unless <tt class="literal"><span class="pre">Value</span></tt> is const. If <tt class="literal"><span class="pre">Value</span></tt>
is <tt class="literal"><span class="pre">const</span> <span class="pre">X</span></tt>, then <tt class="literal"><span class="pre">value_type</span></tt> will be <em>non-</em> <tt class="literal"><span class="pre">const</span> <span class="pre">X</span></tt>.
The default for <tt class="literal"><span class="pre">Value</span></tt> is:</p>
<pre class="literal-block">
iterator_traits&lt; iterator_traits&lt;Iterator&gt;::value_type &gt;::value_type
</pre>
<p>If the default is used for <tt class="literal"><span class="pre">Value</span></tt>, then there must be a
valid specialization of <tt class="literal"><span class="pre">iterator_traits</span></tt> for the value type
of the base iterator.</p>
<p>The <tt class="literal"><span class="pre">Reference</span></tt> parameter will be the <tt class="literal"><span class="pre">reference</span></tt> type of the
<tt class="literal"><span class="pre">indirect_iterator</span></tt>. The default is <tt class="literal"><span class="pre">Value&amp;</span></tt>.</p>
<p>The <tt class="literal"><span class="pre">Access</span></tt> and <tt class="literal"><span class="pre">Traversal</span></tt> parameters are passed
unchanged to the corresponding parameters of the
<tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class, and the <tt class="literal"><span class="pre">Iterator</span></tt> parameter
is passed unchanged as the <tt class="literal"><span class="pre">Base</span></tt> parameter to the
<tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class.</p>
</blockquote>
<p>to:</p>
<blockquote class="last">
<blockquote>
The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, shall be valid
expression and convertible to <tt class="literal"><span class="pre">reference</span></tt>.  <tt class="literal"><span class="pre">Iterator</span></tt>
shall model the traversal concept indicated by
<tt class="literal"><span class="pre">iterator_category</span></tt>.  <tt class="literal"><span class="pre">Value</span></tt>, <tt class="literal"><span class="pre">Reference</span></tt>, and
<tt class="literal"><span class="pre">Difference</span></tt> shall be chosen so that <tt class="literal"><span class="pre">value_type</span></tt>,
<tt class="literal"><span class="pre">reference</span></tt>, and <tt class="literal"><span class="pre">difference_type</span></tt> meet the requirements
indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>.</blockquote>
<p>[Note: there are further requirements on the
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt>
parameter is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied by the algorithm
for deducing the default for the <tt class="literal"><span class="pre">value_type</span></tt> member.]</p>
</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">Not included above is the specification of the
<tt class="literal"><span class="pre">value_type</span></tt>, <tt class="literal"><span class="pre">reference</span></tt>, etc., members, which is handled by
the changes in 9.37x.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-problem-with-transform-iterator-requirements">
<h2><a class="toc-backref" href="#id43" name="x-problem-with-transform-iterator-requirements">9.41x Problem with transform_iterator requirements</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12641:</p>
<blockquote>
The reference type of transform_iterator is <tt class="literal"><span class="pre">result_of&lt;</span>
<span class="pre">UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)</span>
<span class="pre">&gt;::type</span></tt>. The <tt class="literal"><span class="pre">value_type</span></tt> is
<tt class="literal"><span class="pre">remove_cv&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</blockquote>
<p>These are the defaults, right? If the user supplies their own types
that's what gets passed to iterator_adaptor. And again, the
specification should be in terms of the specialization of
iterator_adaptor, and not in terms of the result:</p>
<p>Reference argument to iterator_adaptor:</p>
<pre class="literal-block">
if (Reference != use_default)
    Reference
else
    result_of&lt;
        UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)
    &gt;::type
</pre>
<p>Value argument to iterator_adaptor:</p>
<pre class="literal-block">
if (Value != use_default)
    Value
else if (Reference != use_default)
    remove_reference&lt;reference&gt;::type
else
    remove_reference&lt;
        result_of&lt;
            UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)
        &gt;::type
    &gt;::type
</pre>
<p>There's probably a better way to specify that last alternative, but
I've been at this too long, and it's all turning into a maze of
twisty passages, all alike.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Replace:</p>
<blockquote>
The reference type of transform_iterator is <tt class="literal"><span class="pre">result_of&lt;</span>
<span class="pre">UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)</span>
<span class="pre">&gt;::type</span></tt>. The <tt class="literal"><span class="pre">value_type</span></tt> is
<tt class="literal"><span class="pre">remove_cv&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</blockquote>
<p>with:</p>
<blockquote class="last">
<p>If <tt class="literal"><span class="pre">Reference</span></tt> is <tt class="literal"><span class="pre">use_default</span></tt> then the <tt class="literal"><span class="pre">reference</span></tt>
member of <tt class="literal"><span class="pre">transform_iterator</span></tt> is <tt class="literal"><span class="pre">result_of&lt;</span>
<span class="pre">UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)</span>
<span class="pre">&gt;::type</span></tt>.  Otherwise, <tt class="literal"><span class="pre">reference</span></tt> is <tt class="literal"><span class="pre">Reference</span></tt>.</p>
<p>If <tt class="literal"><span class="pre">Value</span></tt> is <tt class="literal"><span class="pre">use_default</span></tt> then the <tt class="literal"><span class="pre">value_type</span></tt>
member is <tt class="literal"><span class="pre">remove_cv&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.
Otherwise, <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">Value</span></tt>.</p>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-filter-iterator-details-unspecified">
<h2><a class="toc-backref" href="#id44" name="x-filter-iterator-details-unspecified">9.42x filter_iterator details unspecified</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Pete Becker</td>
</tr>
</tbody>
</table>
<p>c++std-lib-12642:</p>
<p>The paper says:</p>
<pre class="literal-block">
template&lt;class Predicate, class Iterator&gt;
class filter_iterator
     : public iterator_adaptor&lt;
         filter_iterator&lt;Predicate, Iterator&gt;,
         Iterator,
         use_default,
         /* see details */ &gt;
</pre>
<p>That comment covers the Access, Traversal, Reference, and Difference
arguments. The only specification for any of these in the details is:</p>
<blockquote>
The access category of the filter_iterator will be the same as
the access category of Iterator.</blockquote>
<p>Needs more.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Add to the synopsis:</p>
<pre class="literal-block">
typedef iterator_traits&lt;Iterator&gt;::value_type value_type;
typedef iterator_traits&lt;Iterator&gt;::reference reference;
typedef iterator_traits&lt;Iterator&gt;::pointer pointer;
typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
typedef /* see below */ iterator_category;
</pre>
<p>and add just after the synopsis:</p>
<blockquote class="last">
If <tt class="literal"><span class="pre">Iterator</span></tt> models Readable Lvalue Iterator and Forward
Traversal Iterator then <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible
to <tt class="literal"><span class="pre">std::forward_iterator_tag</span></tt>. Otherwise
<tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
<tt class="literal"><span class="pre">std::input_iterator_tag</span></tt>.</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-transform-iterator-interoperability-too-restrictive">
<h2><a class="toc-backref" href="#id45" name="x-transform-iterator-interoperability-too-restrictive">9.43x transform_iterator interoperability too restrictive</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Jeremy Siek</td>
</tr>
</tbody>
</table>
<p>We do not need to require that the function objects have the same
type, just that they be convertible.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<pre class="literal-block">
template&lt;class OtherIterator, class R2, class V2&gt;
transform_iterator(
      transform_iterator&lt;UnaryFunction, OtherIterator, R2, V2&gt; const&amp; t
    , typename enable_if_convertible&lt;OtherIterator, Iterator&gt;::type* = 0 // exposition
);
</pre>
<p>to:</p>
<pre class="last literal-block">
template&lt;class F2, class I2, class R2, class V2&gt;
transform_iterator(
      transform_iterator&lt;F2, I2, R2, V2&gt; const&amp; t
    , typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0      // exposition only
    , typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition only
);
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="y-indirect-iterator-and-smart-pointers">
<h2><a class="toc-backref" href="#id46" name="y-indirect-iterator-and-smart-pointers">9.44y <tt class="literal"><span class="pre">indirect_iterator</span></tt> and smart pointers</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">indirect_iterator</span></tt> should be able to iterate over containers of
smart pointers, but the mechanism that allows it was left out of
the specification, even though it's present in the Boost
specification</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Add <tt class="literal"><span class="pre">pointee</span></tt> and <tt class="literal"><span class="pre">indirect_reference</span></tt>
to deal with this capability.</p>
<p>In [lib.iterator.helper.synopsis], add:</p>
<pre class="literal-block">
template &lt;class Dereferenceable&gt;
struct pointee;

template &lt;class Dereferenceable&gt;
struct indirect_reference;
</pre>
<p class="last">After <tt class="literal"><span class="pre">indirect_iterator</span></tt>'s abstract, add:</p>
</td>
</tr>
</tbody>
</table>
<div class="topic">
<p class="topic-title first">Class template <tt class="literal"><span class="pre">pointee</span></tt></p>
<!-- Copyright David Abrahams 2004. Use, modification and distribution is -->
<!-- subject to the Boost Software License, Version 1.0. (See accompanying -->
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template &lt;class Dereferenceable&gt;
struct pointee
{
    typedef /* see below */ type;
};
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body">For an object <tt class="literal"><span class="pre">x</span></tt> of type <tt class="literal"><span class="pre">Dereferenceable</span></tt>, <tt class="literal"><span class="pre">*x</span></tt>
is well-formed.  If <tt class="literal"><span class="pre">++x</span></tt> is ill-formed it shall neither be
ambiguous nor shall it violate access control, and
<tt class="literal"><span class="pre">Dereferenceable::element_type</span></tt> shall be an accessible type.
Otherwise <tt class="literal"><span class="pre">iterator_traits&lt;Dereferenceable&gt;::value_type</span></tt> shall
be well formed.  [Note: These requirements need not apply to
explicit or partial specializations of <tt class="literal"><span class="pre">pointee</span></tt>]</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">type</span></tt> is determined according to the following algorithm, where
<tt class="literal"><span class="pre">x</span></tt> is an object of type <tt class="literal"><span class="pre">Dereferenceable</span></tt>:</p>
<pre class="literal-block">
if ( ++x is ill-formed )
{
    return ``Dereferenceable::element_type``
}
else if (``*x`` is a mutable reference to
         std::iterator_traits&lt;Dereferenceable&gt;::value_type)
{
    return iterator_traits&lt;Dereferenceable&gt;::value_type
}
else
{
    return iterator_traits&lt;Dereferenceable&gt;::value_type const
}
</pre>
</div>
<div class="topic">
<p class="topic-title first">Class template <tt class="literal"><span class="pre">indirect_reference</span></tt></p>
<!-- Copyright David Abrahams 2004. Use, modification and distribution is -->
<!-- subject to the Boost Software License, Version 1.0. (See accompanying -->
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template &lt;class Dereferenceable&gt;
struct indirect_reference
{
    typedef /* see below */ type;
};
</pre>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body">For an object <tt class="literal"><span class="pre">x</span></tt> of type <tt class="literal"><span class="pre">Dereferenceable</span></tt>, <tt class="literal"><span class="pre">*x</span></tt>
is well-formed.  If <tt class="literal"><span class="pre">++x</span></tt> is ill-formed it shall neither be
ambiguous nor shall it violate access control, and
<tt class="literal"><span class="pre">pointee&lt;Dereferenceable&gt;::type&amp;</span></tt> shall be well-formed.
Otherwise <tt class="literal"><span class="pre">iterator_traits&lt;Dereferenceable&gt;::reference</span></tt> shall
be well formed.  [Note: These requirements need not apply to
explicit or partial specializations of <tt class="literal"><span class="pre">indirect_reference</span></tt>]</td>
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">type</span></tt> is determined according to the following algorithm, where
<tt class="literal"><span class="pre">x</span></tt> is an object of type <tt class="literal"><span class="pre">Dereferenceable</span></tt>:</p>
<pre class="literal-block">
if ( ++x is ill-formed )
    return ``pointee&lt;Dereferenceable&gt;::type&amp;``
else
    std::iterator_traits&lt;Dereferenceable&gt;::reference
</pre>
</div>
<p>See proposed resolution to Issue 9.37x for more changes related to
this issue.</p>
</div>
<div class="section" id="y-n1530-typos-and-editorial-changes-in-proposal-text-not-standardese">
<h2><a class="toc-backref" href="#id47" name="y-n1530-typos-and-editorial-changes-in-proposal-text-not-standardese">9.45y N1530: Typos and editorial changes in proposal text (not standardese)</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
</tbody>
</table>
<ol class="arabic">
<li><p class="first">&quot;because specification helps to highlight that the <tt class="literal"><span class="pre">Reference</span></tt>
template parameter may not always be identical to the iterator's
<tt class="literal"><span class="pre">reference</span></tt> type, and will keep users making mistakes based on
that assumption.&quot;</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">add &quot;from&quot; before &quot;making&quot;</p>
</td>
</tr>
</tbody>
</table>
</li>
<li><p class="first">mention of obsolete projection_iterator</p>
</li>
</ol>
<blockquote>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed Resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">From n1530, in the <strong>Specialized Adaptors</strong> section, remove:</p>
<blockquote class="last">
<tt class="literal"><span class="pre">projection_iterator</span></tt>, which is similar to <tt class="literal"><span class="pre">transform_iterator</span></tt>
except that when dereferenced it returns a reference instead of
a value.</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Rationale:</th><td class="field-body">This iterator was in the original boost library, but the new
iterator concepts allowed this iterator to be
folded into <tt class="literal"><span class="pre">transform_iterator</span></tt>.</td>
</tr>
</tbody>
</table>
</blockquote>
</div>
<div class="section" id="y-n1530-base-return-by-value-is-costly">
<h2><a class="toc-backref" href="#id48" name="y-n1530-base-return-by-value-is-costly">9.46y N1530: <tt class="literal"><span class="pre">base()</span></tt> return-by-value is costly</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Dave Abrahams</td>
</tr>
</tbody>
</table>
<p>We've had some real-life reports that iterators that use
<tt class="literal"><span class="pre">iterator_adaptor</span></tt>'s <tt class="literal"><span class="pre">base()</span></tt> function can be inefficient
when the <tt class="literal"><span class="pre">Base</span></tt> iterator is expensive to copy.  Iterators, of
all things, should be efficient.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">In [lib.iterator.adaptor]</p>
<p>Change:</p>
<pre class="literal-block">
Base base() const;
</pre>
<p>to:</p>
<pre class="literal-block">
Base const&amp; base() const;
</pre>
<p class="last">twice (once in the synopsis and once in the <strong>public
operations</strong> section).</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-forgot-default-constructible-in-forward-traversal-iterator">
<h2><a class="toc-backref" href="#id49" name="x-forgot-default-constructible-in-forward-traversal-iterator">9.47x Forgot default constructible in Forward Traversal Iterator</a></h2>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Submitter:</th><td class="field-body">Jeremy Siek</td>
</tr>
</tbody>
</table>
<p>We want Forward Traversal Iterator plus Readable Lvalue Iterator to
match the old Foward Iterator requirements, so we need Forward
Traversal Iterator to include Default Constructible.</p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Proposed resolution:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">Change:</p>
<blockquote>
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Forward Traversal Iterator</em>
concept if the following expressions are valid and respect the stated
semantics.</p>
<table border="1" class="table">
<colgroup>
<col width="44%" />
<col width="39%" />
<col width="17%" />
</colgroup>
<tbody valign="top">
<tr><td colspan="3">Forward Traversal Iterator Requirements (in addition to Single Pass Iterator)</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote class="last">
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Forward Traversal Iterator</em>
concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> meeting the requirements of
Default Constructible and Single Pass Iterator, the following
expressions are valid and respect the
stated semantics.</p>
<table border="1" class="table">
<colgroup>
<col width="38%" />
<col width="34%" />
<col width="27%" />
</colgroup>
<tbody valign="top">
<tr><td colspan="3">Forward Traversal Iterator Requirements (in addition to Default Constructible and Single Pass Iterator)</td>
</tr>
</tbody>
</table>
</blockquote>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="x-editorial-changes-non-normative-text">
<h2><a class="toc-backref" href="#id50" name="x-editorial-changes-non-normative-text">9.48x Editorial changes (non-normative text)</a></h2>
<dl>
<dt>Change:</dt>
<dd>Iterator facade uses the Curiously Recurring Template Pattern (CRTP)
[Cop95] so that the user can specify the behavior of
<tt class="literal"><span class="pre">iterator_facade</span></tt> in a derived class.  Former designs used policy
objects to specify the behavior.  <tt class="literal"><span class="pre">iterator_facade</span></tt> does not use policy
objects for several reasons:</dd>
<dt>to:</dt>
<dd>Iterator facade uses the Curiously Recurring Template
Pattern (CRTP) [Cop95] so that the user can specify the behavior
of <tt class="literal"><span class="pre">iterator_facade</span></tt> in a derived class.  Former designs used
policy objects to specify the behavior, but that approach was
discarded for several reasons:</dd>
<dt>Change:</dt>
<dd>iterator's <tt class="literal"><span class="pre">operator++</span></tt> returns the iterator type itself means
that all iterators generated by <tt class="literal"><span class="pre">iterator_facade</span></tt> would be
instantiations of <tt class="literal"><span class="pre">iterator_facade</span></tt>.  Cumbersome type generator</dd>
<dt>to:</dt>
<dd>iterator's <tt class="literal"><span class="pre">operator++</span></tt> returns the iterator type itself
would mean that all iterators built with the library would
have to be specializations of <tt class="literal"><span class="pre">iterator_facade&lt;...&gt;</span></tt>, rather
than something more descriptive like
<tt class="literal"><span class="pre">indirect_iterator&lt;T*&gt;</span></tt>.  Cumbersome type generator</dd>
<dt>Change:</dt>
<dd>The return type for <tt class="literal"><span class="pre">operator-&gt;</span></tt> and <tt class="literal"><span class="pre">operator[]</span></tt> is not
explicitly specified. Instead it requires each <tt class="literal"><span class="pre">iterator_facade</span></tt>
instantiation to meet the requirements of its <tt class="literal"><span class="pre">iterator_category</span></tt>.</dd>
<dt>To:</dt>
<dd>The return types for <tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">operator-&gt;</span></tt> and
<tt class="literal"><span class="pre">operator[]</span></tt> are not explicitly specified. Instead, those types
are described in terms of a set of requirements, which must be
satisfied by the <tt class="literal"><span class="pre">iterator_facade</span></tt> implementation.</dd>
</dl>
</div>
<div class="section" id="x-clarification-of-iterator-facade-requirements-and-type-members">
<h2><a class="toc-backref" href="#id51" name="x-clarification-of-iterator-facade-requirements-and-type-members">9.49x Clarification of iterator_facade requirements and type members</a></h2>
<p>A general cleanup and simplification of the requirements and
description of type members for <tt class="literal"><span class="pre">iterator_facade</span></tt>.</p>
<p>The user is only allowed to add <tt class="literal"><span class="pre">const</span></tt> as a qualifier.</p>
<dl>
<dt>Change:</dt>
<dd><tt class="literal"><span class="pre">typedef</span> <span class="pre">remove_cv&lt;Value&gt;::type</span> <span class="pre">value_type;</span></tt></dd>
<dt>to:</dt>
<dd><tt class="literal"><span class="pre">typedef</span> <span class="pre">remove_const&lt;Value&gt;::type</span> <span class="pre">value_type;</span></tt></dd>
</dl>
<p>We use to have an unspecified type for <tt class="literal"><span class="pre">pointer</span></tt>, to match the
return type of <tt class="literal"><span class="pre">operator-&gt;</span></tt>, but there's no real reason to make them
match, so we just use the simpler <tt class="literal"><span class="pre">Value*</span></tt> for <tt class="literal"><span class="pre">pointer</span></tt>.</p>
<p>Change:</p>
<blockquote>
<tt class="literal"><span class="pre">typedef</span> <span class="pre">/*</span> <span class="pre">see</span> <span class="pre">description</span> <span class="pre">of</span> <span class="pre">operator-&gt;</span> <span class="pre">*/</span> <span class="pre">pointer;</span></tt></blockquote>
<dl>
<dt>To:</dt>
<dd><tt class="literal"><span class="pre">typedef</span> <span class="pre">Value*</span> <span class="pre">pointer;</span></tt></dd>
<dt>Remove:</dt>
<dd>Some of the constraints on template parameters to
<tt class="literal"><span class="pre">iterator_facade</span></tt> are expressed in terms of resulting nested
types and should be viewed in the context of their impact on
<tt class="literal"><span class="pre">iterator_traits&lt;Derived&gt;</span></tt>.</dd>
<dt>Change:</dt>
<dd>The <tt class="literal"><span class="pre">Derived</span></tt> template parameter must be a class derived from
<tt class="literal"><span class="pre">iterator_facade</span></tt>.</dd>
<dt>and:</dt>
<dd>The following table describes the other requirements on the
<tt class="literal"><span class="pre">Derived</span></tt> parameter.  Depending on the resulting iterator's
<tt class="literal"><span class="pre">iterator_category</span></tt>, a subset of the expressions listed in the table
are required to be valid.  The operations in the first column must be
accessible to member functions of class <tt class="literal"><span class="pre">iterator_core_access</span></tt>.</dd>
<dt>to:</dt>
<dd>The following table describes the typical valid expressions on
<tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Derived</span></tt> parameter, depending on the
iterator concept(s) it will model.  The operations in the first
column must be made accessible to member functions of class
<tt class="literal"><span class="pre">iterator_core_access</span></tt>.  In addition,
<tt class="literal"><span class="pre">static_cast&lt;Derived*&gt;(iterator_facade*)</span></tt> shall be well-formed.</dd>
<dt>Remove:</dt>
<dd><p class="first">The nested <tt class="literal"><span class="pre">::value_type</span></tt> type will be the same as
<tt class="literal"><span class="pre">remove_cv&lt;Value&gt;::type</span></tt>, so the <tt class="literal"><span class="pre">Value</span></tt> parameter must be
an (optionally <tt class="literal"><span class="pre">const</span></tt>-qualified) non-reference type.</p>
<p class="last">The nested <tt class="literal"><span class="pre">::reference</span></tt> will be the same as the <tt class="literal"><span class="pre">Reference</span></tt>
parameter; it must be a suitable reference type for the resulting
iterator.  The default for the <tt class="literal"><span class="pre">Reference</span></tt> parameter is
<tt class="literal"><span class="pre">Value&amp;</span></tt>.</p>
</dd>
</dl>
<p>Change:</p>
<blockquote>
<p>In the table below, <tt class="literal"><span class="pre">X</span></tt> is the derived iterator type, <tt class="literal"><span class="pre">a</span></tt> is an
object of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">b</span></tt> and <tt class="literal"><span class="pre">c</span></tt> are objects of type <tt class="literal"><span class="pre">const</span> <span class="pre">X</span></tt>,
<tt class="literal"><span class="pre">n</span></tt> is an object of <tt class="literal"><span class="pre">X::difference_type</span></tt>, <tt class="literal"><span class="pre">y</span></tt> is a constant
object of a single pass iterator type interoperable with X, and <tt class="literal"><span class="pre">z</span></tt>
is a constant object of a random access traversal iterator type
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
<table border="1" class="table">
<colgroup>
<col width="19%" />
<col width="18%" />
<col width="36%" />
<col width="26%" />
</colgroup>
<thead valign="bottom">
<tr><th>Expression</th>
<th>Return Type</th>
<th>Assertion/Note</th>
<th>Required to implement
Iterator Concept(s)</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">c.dereference()</span></tt></td>
<td><tt class="literal"><span class="pre">X::reference</span></tt></td>
<td>&nbsp;</td>
<td>Readable Iterator, Writable
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">c.equal(b)</span></tt></td>
<td>convertible to bool</td>
<td>true iff <tt class="literal"><span class="pre">b</span></tt> and <tt class="literal"><span class="pre">c</span></tt> are
equivalent.</td>
<td>Single Pass Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">c.equal(y)</span></tt></td>
<td>convertible to bool</td>
<td>true iff <tt class="literal"><span class="pre">c</span></tt> and <tt class="literal"><span class="pre">y</span></tt> refer to the
same position.  Implements <tt class="literal"><span class="pre">c</span> <span class="pre">==</span> <span class="pre">y</span></tt>
and <tt class="literal"><span class="pre">c</span> <span class="pre">!=</span> <span class="pre">y</span></tt>.</td>
<td>Single Pass Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">a.advance(n)</span></tt></td>
<td>unused</td>
<td>&nbsp;</td>
<td>Random Access Traversal
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">a.increment()</span></tt></td>
<td>unused</td>
<td>&nbsp;</td>
<td>Incrementable Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">a.decrement()</span></tt></td>
<td>unused</td>
<td>&nbsp;</td>
<td>Bidirectional Traversal
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">c.distance_to(b)</span></tt></td>
<td>convertible to
X::difference_type</td>
<td>equivalent to <tt class="literal"><span class="pre">distance(c,</span> <span class="pre">b)</span></tt></td>
<td>Random Access Traversal
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">c.distance_to(z)</span></tt></td>
<td>convertible to
X::difference_type</td>
<td>equivalent to <tt class="literal"><span class="pre">distance(c,</span> <span class="pre">z)</span></tt>.
Implements <tt class="literal"><span class="pre">c</span> <span class="pre">-</span> <span class="pre">z</span></tt>, <tt class="literal"><span class="pre">c</span> <span class="pre">&lt;</span> <span class="pre">z</span></tt>, <tt class="literal"><span class="pre">c</span>
<span class="pre">&lt;=</span> <span class="pre">z</span></tt>, <tt class="literal"><span class="pre">c</span> <span class="pre">&gt;</span> <span class="pre">z</span></tt>, and <tt class="literal"><span class="pre">c</span> <span class="pre">&gt;=</span> <span class="pre">c</span></tt>.</td>
<td>Random Access Traversal
Iterator</td>
</tr>
</tbody>
</table>
</blockquote>
<p>to:</p>
<blockquote>
<p>In the table below, <tt class="literal"><span class="pre">F</span></tt> is <tt class="literal"><span class="pre">iterator_facade&lt;X,V,C,R,D&gt;</span></tt>, <tt class="literal"><span class="pre">a</span></tt> is an
object of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">b</span></tt> and <tt class="literal"><span class="pre">c</span></tt> are objects of type <tt class="literal"><span class="pre">const</span> <span class="pre">X</span></tt>,
<tt class="literal"><span class="pre">n</span></tt> is an object of <tt class="literal"><span class="pre">F::difference_type</span></tt>, <tt class="literal"><span class="pre">y</span></tt> is a constant
object of a single pass iterator type interoperable with <tt class="literal"><span class="pre">X</span></tt>, and <tt class="literal"><span class="pre">z</span></tt>
is a constant object of a random access traversal iterator type
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
<p><strong>iterator_facade Core Operations</strong></p>
<table border="1" class="table">
<colgroup>
<col width="21%" />
<col width="23%" />
<col width="27%" />
<col width="29%" />
</colgroup>
<thead valign="bottom">
<tr><th>Expression</th>
<th>Return Type</th>
<th>Assertion/Note</th>
<th>Used to implement Iterator
Concept(s)</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="literal"><span class="pre">c.dereference()</span></tt></td>
<td><tt class="literal"><span class="pre">F::reference</span></tt></td>
<td>&nbsp;</td>
<td>Readable Iterator, Writable
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">c.equal(y)</span></tt></td>
<td>convertible to bool</td>
<td>true iff <tt class="literal"><span class="pre">c</span></tt> and <tt class="literal"><span class="pre">y</span></tt>
refer to the same
position.</td>
<td>Single Pass Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">a.increment()</span></tt></td>
<td>unused</td>
<td>&nbsp;</td>
<td>Incrementable Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">a.decrement()</span></tt></td>
<td>unused</td>
<td>&nbsp;</td>
<td>Bidirectional Traversal
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">a.advance(n)</span></tt></td>
<td>unused</td>
<td>&nbsp;</td>
<td>Random Access Traversal
Iterator</td>
</tr>
<tr><td><tt class="literal"><span class="pre">c.distance_to(z)</span></tt></td>
<td>convertible to
<tt class="literal"><span class="pre">F::difference_type</span></tt></td>
<td>equivalent to
<tt class="literal"><span class="pre">distance(c,</span> <span class="pre">X(z))</span></tt>.</td>
<td>Random Access Traversal
Iterator</td>
</tr>
</tbody>
</table>
</blockquote>
</div>
</div>
</div>
<hr class="footer" />
<div class="footer">
<a class="reference" href="iter-issue-list.rst">View document source</a>.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body>
</html>