summaryrefslogtreecommitdiff
path: root/libs/fusion/doc/algorithm.qbk
blob: 7402ba330c0f5d03c001555f4e6f7f1bf5479087 (plain)
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
[/==============================================================================
    Copyright (C) 2001-2011 Joel de Guzman
    Copyright (C) 2006 Dan Marsden
    Copyright (C) 2010 Christopher Schmidt

    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)
===============================================================================/]
[section Algorithm]

[heading Lazy Evaluation]

Unlike __mpl__, Fusion algorithms are lazy[footnote Except for some
special cases such as __for_each__ and __copy__ which are inherently
imperative algorithms.] and non sequence-type preserving [footnote What
does that mean? It means that when you operate on a sequence through a
Fusion algorithm that returns a sequence, the sequence returned may not
be of the same class as the original]. This is by design. Runtime
efficiency is given a high priority. Like __mpl__, and unlike __stl__,
fusion algorithms are mostly functional in nature such that algorithms
are non mutating (no side effects). However, due to the high cost of
returning full sequences such as vectors and lists, /Views/ are returned
from Fusion algorithms instead. For example, the __transform__ algorithm
does not actually return a transformed version of the original sequence.
__transform__ returns a __transform_view__. This view holds a reference
to the original sequence plus the transform function. Iteration over the
__transform_view__ will apply the transform function over the sequence
elements on demand. This /lazy/ evaluation scheme allows us to chain as
many algorithms as we want without incurring a high runtime penalty.

[heading Sequence Extension]

The /lazy/ evaluation scheme where __algorithms__ return __views__ also
allows operations such as __push_back__ to be totally generic. In Fusion,
__push_back__ is actually a generic algorithm that works on all sequences.
Given an input sequence `s` and a value `x`, Fusion's __push_back__
algorithm simply returns a __joint_view__: a view that holds a reference to
the original sequence `s` and the value `x`. Functions that were once
sequence specific and need to be implemented N times over N different
sequences are now implemented only once. That is to say that Fusion
sequences are cheaply extensible.

To regain the original sequence, __conversion__ functions are provided. You
may use one of the __conversion__ functions to convert back to the original
sequence type.

[heading Header]

    #include <boost/fusion/algorithm.hpp>
    #include <boost/fusion/include/algorithm.hpp>

[section Auxiliary]

The auxiliary algorithms provide the utility algorithms for sequences.

[heading Header]

    #include <boost/fusion/algorithm/auxiliary.hpp>
    #include <boost/fusion/include/auxiliary.hpp>

[section Functions]

[section copy]

[heading Description]
Copy a sequence `src` to a sequence `dest`.
It is also used to convert sequence into other.

[heading Synopsis]
    template <typename Seq1, typename Seq2>
    void copy(Seq1 const& src, Seq2& dest);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`src`][A model of __forward_sequence__, all elements contained in the `src` sequence should be convertible into the element contained in the `dest` sequence.][Operation's argument]]
    [[`dest`][A model of __forward_sequence__, `e2 = e1` is valid expression for each pair of elements `e1` of `src` and `e2` of `dest`.][Operation's argument]]
]

[heading Expression Semantics]
    __copy__(src, dest);

[*Return type]: `void`

[*Semantics]: `e2 = e1` for each element `e1` in `src` and `e2` in `dest`.

[heading Complexity]
Linear, exactly `__result_of_size__<Sequence>::value`.

[heading Header]

    #include <boost/fusion/algorithm/auxiliary/copy.hpp>
    #include <boost/fusion/include/copy.hpp>

[heading Example]
    __vector__<int,int> vec(1,2);
    __list__<int,int> ls;
    __copy__(vec, ls);
    assert(ls == __make_list__(1,2));

[endsect]

[endsect]

[endsect]


[section Iteration]

The iteration algorithms provide the fundamental algorithms for traversing
a sequence repeatedly applying an operation to its elements.

[heading Header]

    #include <boost/fusion/algorithm/iteration.hpp>
    #include <boost/fusion/include/iteration.hpp>

[section Functions]

[template fold_desc[name result_of_name arg_desc seq_concept arg_id arg_type_id invoke_desc semantics_elements_desc example_arg_transform example_result I0 I1 IN]
[heading Description]
For a sequence `seq`, initial state `initial_state`, and binary function object
or function pointer `f`, [^[name]] returns the result of the repeated application of
binary `f` to the result of the previous `f` invocation (`inital_state` if it is
the first call) and [arg_desc] of `seq`.

[def name_macro [name]]
[def result_of_name_macro [result_of_name]]
[heading Synopsis]
    template<
        typename Sequence,
        typename State,
        typename F
        >
    typename result_of_name_macro<Sequence, State const, F>::type name_macro(
        Sequence& seq, State const& initial_state, F f);
        
    template<
        typename Sequence,
        typename State,
        typename F
        >
    typename result_of_name_macro<Sequence const, State const, F>::type name_macro(
        Sequence const& seq, State const& initial_state, F f);

[def seq_concept_macro [seq_concept]]
[def arg_type_id_macro [arg_type_id]]
[def arg_id_macro [arg_id]]
[def invoke_desc_macro [invoke_desc]]
[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of seq_concept_macro][Operation's argument]]
    [[`initial_state`][Any type][Initial state]]
    [[`f`][`f(s,arg_id_macro)` with return type `__boost_result_of_call__<F(S,arg_type_id_macro)>::type` for current state `s` of type `S`, and for each invoke_desc_macro][Operation's argument]]
]

[heading Expression Semantics]
    name_macro(seq, initial_state, f);

[*Return type]: Any type

[*Semantics]: Equivalent to [^f(... f(f(initial_state,[arg_id][I0]),[arg_id][I1]) ...[arg_id][IN])] where [^[arg_id]1 ...[arg_id]N] are [semantics_elements_desc].

[heading Complexity]
Linear, exactly `__result_of_size__<Sequence>::value` applications of `f`.

[heading Header]

    #include <boost/fusion/algorithm/iteration/name_macro.hpp>
    #include <boost/fusion/include/name_macro.hpp>

[def example_result_macro [example_result]]
[def example_arg_transform_macro [example_arg_transform]]
[heading Example]
    struct make_string
    {
        typedef std::string result_type;

        template<typename T>
        std::string operator()(const std::string& str, const T& t) const
        {
            return str + boost::lexical_cast<std::string>(example_arg_transform_macro);
        }
    };
    ...
    const __vector__<int,int> vec(1,2);
    assert(name_macro(vec,std::string(""), make_string()) == example_result_macro);
]

[section fold]
[fold_desc fold..__result_of_fold__..each element..__forward_sequence__..e..E..element `e` of type `E` in `seq`..the consecutive elements of `seq`..t.."12"..1..2..N]
[endsect]

[section reverse_fold]
[fold_desc reverse_fold..__result_of_reverse_fold__..each element..__bidirectional_sequence__..e..E..element `e` of type `E` in `seq`..the consecutive elements of `seq`..t.."21"..N..N-1..1]
[endsect]

[section iter_fold]
[fold_desc iter_fold..__result_of_iter_fold__..iterators on each element..__forward_sequence__..it..It..iterator `it` of type `It` on an element of `seq`..consecutive iterators on the elements of `seq`..__deref__(t).."12"..1..2..N]
[endsect]

[section reverse_iter_fold]
[fold_desc reverse_iter_fold..__result_of_reverse_iter_fold__..iterators on each element..__bidirectional_sequence__..it..It..iterator `it` of type `It` on an element of `seq`..consecutive iterators on the elements of `seq`..__deref__(t).."21"..N..N-1..1]
[endsect]

[section accumulate]
[fold_desc accumulate..__result_of_accumulate__..each element..__forward_sequence__..e..E..element `e` of type `E` in `seq`..the consecutive elements of `seq`..t.."12"..1..2..N]
[endsect]

[section for_each]

[heading Description]
Applies a unary function object to each element of a sequence.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_for_each__<Sequence, F>::type for_each(
        Sequence& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `f(e)` must be a valid expression for each element `e` in `seq`][Operation's argument]]
    [[`f`][A unary __reg_callable_obj__][Operation's argument]]
]

[heading Expression Semantics]
    __for_each__(seq, f);

[*Return type]: `void`

[*Semantics]: Calls `f(e)` for each element `e` in `seq`.

[heading Complexity]
Linear, exactly `__result_of_size__<Sequence>::value` applications of `f`.

[heading Header]

    #include <boost/fusion/algorithm/iteration/for_each.hpp>
    #include <boost/fusion/include/for_each.hpp>

[heading Example]
    struct increment
    {
        template<typename T>
        void operator()(T& t) const
        {
            ++t;
        }
    };
    ...
    __vector__<int,int> vec(1,2);
    __for_each__(vec, increment());
    assert(vec == __make_vector__(2,3));

[endsect]

[endsect]

[section Metafunctions]

[template meta_fold_desc[name name_func seq_concept arg_id arg_type_id invoke_meta_desc]
[heading Description]
Returns the result type of [name_func].

[def name_macro [name]]
[heading Synopsis]
    template<
        typename Sequence,
        typename State,
        typename F>
    struct name_macro
    {
        typedef __unspecified__ type;
    };

[def seq_concept_macro [seq_concept]]
[def arg_type_id_macro [arg_type_id]]
[def arg_id_macro [arg_id]]
[def invoke_meta_desc_macro [invoke_meta_desc]]
[table Parameters
    [[Parameter]  [Requirement] [Description]]
    [[`Sequence`] [A model of seq_concept_macro]    [The sequence to iterate]]
    [[`State`]    [Any type]                        [The initial state for the first application of `F`]]
    [[`F`]        [`__boost_result_of_call__<F(S,arg_type_id_macro)>::type` is the return type of `f(s,arg_id_macro)` with current state `s` of type `S`, and an invoke_meta_desc_macro][The operation to be applied on traversal]]
]

[heading Expression Semantics]
    name_macro<Sequence, State, F>::type

[*Return type]: Any type

[*Semantics]: Returns the result of applying [name_func] to a sequence of type
`Sequence`, with an initial state of type `State` and binary function object or
function pointer of type `F`.

[heading Complexity]
Linear, exactly `__result_of_size__<Sequence>::value` applications of `F`.

[heading Header]

    #include <boost/fusion/algorithm/iteration/name_macro.hpp>
    #include <boost/fusion/include/name_macro.hpp>
]

[section fold]
[meta_fold_desc fold..__fold__..__forward_sequence__..e..E..element `e` of type `E` in `seq`]
[endsect]

[section reverse_fold]
[meta_fold_desc reverse_fold..__reverse_fold__..__bidirectional_sequence__..e..E..element `e` of type `E` in `seq`]
[endsect]

[section iter_fold]
[meta_fold_desc iter_fold..__iter_fold__..__forward_sequence__..it..It..iterator `it` of type `It` on an element of `seq`]
[endsect]

[section reverse_iter_fold]
[meta_fold_desc reverse_iter_fold..__reverse_iter_fold__..__bidirectional_sequence__..it..It..iterator `it` of type `It` on an element of `seq`]
[endsect]

[section accumulate]
[meta_fold_desc accumulate..__accumulate__..__forward_sequence__..e..E..element `e` of type `E` in `seq`]
[endsect]

[section for_each]
A metafunction returning the result type of applying __for_each__ to a sequence. The
return type of __for_each__ is always `void`.

[heading Description]

[heading Synopsis]
    template<
        typename Sequence,
        typename F
    >
    struct for_each
    {
        typedef void type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`F`]    [Any type] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_for_each__<Sequence, F>::type

[*Return type]: `void`.

[*Semantics]: Returns the return type of __for_each__ for a sequence of type `Sequence` and a unary function object `F`.
The return type is always `void`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/iteration/for_each.hpp>
    #include <boost/fusion/include/for_each.hpp>

[endsect]

[endsect]

[endsect]

[section Query]
The query algorithms provide support for searching and analyzing sequences.

[heading Header]

    #include <boost/fusion/algorithm/query.hpp>
    #include <boost/fusion/include/query.hpp>

[section Functions]

[section any]

[heading Description]
For a sequence `seq` and unary function object `f`, `any` returns true if `f` returns true for at least one element of `seq`.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_any__<Sequence,F>::type any(
        Sequence const& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `f(e)` must be a valid expression, convertible to `bool`, for each element `e` in `seq`][The sequence to search]]
    [[`f`][A unary function object][The search predicate]]
]

[heading Expression semantics]
    __any__(seq, f);

[*Return type]: `bool`

[*Semantics]: Returns true if and only if `f(e)` evaluates to `true` for some element `e` in `seq`.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/any.hpp>
    #include <boost/fusion/include/any.hpp>

[heading Example]
    struct odd
    {
        template<typename T>
        bool operator()(T t) const
        {
            return t % 2;
        }
    };
    ...
    assert(__any__(__make_vector__(1,2), odd()));
    assert(!__any__(__make_vector__(2,4), odd()));

[endsect]

[section all]

[heading Description]
For a sequence `seq` and unary function object `f`, `all` returns true if `f` returns true for every element of `seq`.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_all__<Sequence,F>::type all(
        Sequence const& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `f(e)` is a valid expression, convertible to `bool`, for every element `e` in `seq`][The sequence to search]]
    [[`f`][A unary function object][The search predicate]]
]

[heading Expression Semantics]
    __all__(seq, f);

[*Return type]: `bool`

[*Semantics]: Returns true if and only if `f(e)` evaluates to `true` for every element `e` in `seq`.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/all.hpp>
    #include <boost/fusion/include/all.hpp>

[heading Example]
    struct odd
    {
        template<typename T>
        bool operator()(T t) const
        {
            return t % 2;
        }
    };
    ...
    assert(__all__(__make_vector__(1,3), odd()));
    assert(!__all__(__make_vector__(1,2), odd()));

[endsect]

[section none]

[heading Description]
For a sequence `seq` and unary function object `f`, `none` returns true if `f` returns false for every element of `seq`.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_none__<Sequence,F>::type none(
        Sequence const& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `f(e)` is a valid expression, convertible to `bool`, for every element `e` in `seq`][The sequence to search]]
    [[`f`][A unary function object][The search predicate]]
]

[heading Expression Semantics]
    __none__(seq, f);

[*Return type]: `bool`

[*Semantics]: Returns true if and only if `f(e)` evaluates to `false` for every element `e` in `seq`. Result equivalent to `!any(seq, f)`.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/none.hpp>
    #include <boost/fusion/include/none.hpp>

[heading Example]
    struct odd
    {
        template<typename T>
        bool operator()(T t) const
        {
            return t % 2;
        }
    };
    ...
    assert(__none__(__make_vector__(2,4), odd()));
    assert(!__none__(__make_vector__(1,2), odd()));

[endsect]

[section find]

[heading Description]
Finds the first element of a given type within a sequence.

[heading Synopsis]
    template<
        typename T,
        typename Sequence
        >
    __unspecified__ find(Sequence const& seq);

    template<
        typename T,
        typename Sequence
        >
    __unspecified__ find(Sequence& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][The sequence to search]]
    [[`T`][Any type][The type to search for]]
]

[heading Expression Semantics]
    __find__<T>(seq)

[*Return type]: A model of the same iterator category as the iterators of `seq`.

[*Semantics]: Returns an iterator to the first element of `seq` of type `T`, or `__end__(seq)` if there is no such element.
Equivalent to `__find_if__<boost::is_same<_, T> >(seq)`

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/find.hpp>
    #include <boost/fusion/include/find.hpp>

[heading Example]
    const __vector__<char,int> vec('a','0');
    assert(*__find__<int>(vec) == '0');
    assert(__find__<double>(vec) == __end__(vec));

[endsect]

[section find_if]
Finds the first element within a sequence with a type for which a given __mpl_lambda_expression__ evaluates to
`boost::mpl::true_`.

[heading Description]

[heading Synopsis]
    template<
        typename F,
        typename Sequence
        >
    __unspecified__ find_if(Sequence const& seq);

    template<
        typename F,
        typename Sequence
        >
    __unspecified__ find_if(Sequence& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][The sequence to search]]
    [[`F`][A unary __mpl_lambda_expression__][The search predicate]]
]

[heading Expression Semantics]
    __find_if__<F>(seq)

[*Return type]: An iterator of the same iterator category as the iterators of `seq`.

[*Semantics]: Returns the first element of `seq` for which __mpl_lambda_expression__ `F` evaluates to `boost::mpl::true_`,
or `__end__(seq)` if there is no such element.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/include/find_if.hpp>

[heading Example]
    const __vector__<double,int> vec(1.0,2);
    assert(*__find_if__<is_integral<mpl::_> >(vec) == 2);
    assert(__find_if__<is_class<mpl::_> >(vec) == __end__(vec));

[endsect]

[section count]

[heading Description]
Returns the number of elements of a given type within a sequence.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    typename __result_of_count__<Sequence, T>::type count(
        Sequence const& seq, T const& t);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `e == t` must be a valid expression, convertible to `bool`, for each element `e` in `seq`][The sequence to search]]
    [[`T`][Any type][The type to count]]
]

[heading Expression Semantics]
    __count__(seq, t);

[*Return type]: `int`

[*Semantics]: Returns the number of elements of type `T` and equal to `t` in `seq`.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/count.hpp>
    #include <boost/fusion/include/count.hpp>

[heading Example]
    const __vector__<double,int,int> vec(1.0,2,3);
    assert(__count__(vec,2) == 1);

[endsect]

[section count_if]

[heading Description]
Returns the number of elements within a sequence with a type for which a given unary function object evaluates to
`true`.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_count_if__<Sequence, F>::type count_if(
        Sequence const& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `f(e)` is a valid expression, convertible to `bool`, for each element `e` in `seq`][The sequence to search]]
    [[`f`][A unary function object][The search predicate]]
]

[heading Expression Semantics]
    __count_if__(seq, f)

[*Return type]: `int`

[*Semantics]: Returns the number of elements in `seq` where `f` evaluates to `true`.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/count_if.hpp>
    #include <boost/fusion/include/count_if.hpp>

[heading Example]
    const __vector__<int,int,int> vec(1,2,3);
    assert(__count_if__(vec,odd()) == 2);

[endsect]

[endsect]

[section Metafunctions]

[section any]

[heading Description]
A metafunction returning the result type of __any__.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    struct any
    {
        typedef bool type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`F`]       [A model of unary __poly_func_obj__] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_any__<Sequence, F>::type

[*Return type]: `bool`.

[*Semantics]: Returns the return type of __any__ given a sequence of type `Sequence` and a unary __poly_func_obj__ of type `F`. The return type is always `bool`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/query/any.hpp>
    #include <boost/fusion/include/any.hpp>

[endsect]

[section all]

[heading Description]
A metafunction returning the result type of __all__.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    struct all
    {
        typedef bool type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`F`]        [A model of unary __poly_func_obj__] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_all__<Sequence, F>::type

[*Return type]: `bool`.

[*Semantics]: Returns the return type of __all__ given a sequence of type `Sequence` and a unary __poly_func_obj__ of type `F`. The return type is always `bool`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/query/all.hpp>
    #include <boost/fusion/include/all.hpp>

[endsect]

[section none]

[heading Description]
A metafunction returning the result type of __none__.

[heading Synopsis]
    template<
        typename Sequence,
        typename F
        >
    struct none
    {
        typedef bool type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`F`]        [A model of unary __poly_func_obj__] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_none__<Sequence, F>::type

[*Return type]: `bool`.

[*Semantics]: Returns the return type of __none__ given a sequence of type `Sequence` and a unary __poly_func_obj__ of type `F`. The return type is always `bool`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/query/none.hpp>
    #include <boost/fusion/include/none.hpp>

[endsect]

[section find]

[heading Description]
Returns the result type of __find__, given the sequence and search types.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct find
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [Model of __forward_sequence__] [Operation's argument]]
    [[`T`]        [Any type] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_find__<Sequence, T>::type

[*Return type]: A model of the same iterator category as the iterators of `Sequence`.

[*Semantics]: Returns an iterator to the first element of type `T` in `Sequence`, or `__result_of_end__<Sequence>::type` if there is no such element.

[heading Complexity]
Linear, at most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/find.hpp>
    #include <boost/fusion/include/find.hpp>

[endsect]

[section find_if]

[heading Description]
Returns the result type of __find_if__ given the sequence and predicate types.

[heading Synopsis]
    template<
        typename Sequence,
        typename Pred
        >
    struct find_if
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`Pred`]     [A model of __mpl_lambda_expression__] [Operation's arguments]]
]

[heading Expression Semantics]
    __result_of_find_if__<Sequence, Pred>::type

[*Return type]: A model of the same iterator category as the iterators of `Sequence`.

[*Semantics]: Returns an iterator to the first element in `Sequence` for which `Pred` evaluates to true. Returns `__result_of_end__<Sequence>::type` if there is no such element.

[heading Complexity]
Linear. At most `__result_of_size__<Sequence>::value` comparisons.

[heading Header]

    #include <boost/fusion/algorithm/query/find_if.hpp>
    #include <boost/fusion/include/find_if.hpp>

[endsect]

[section count]

[heading Description]
A metafunction that returns the result type of `count` given the sequence and search types.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct count
    {
        typedef int type;
    };

[table Parameters
    [[Parameter] [Requirement] [heading Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`T`] [Any type] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_count__<T>::type

[*Return type]: `int`.

[*Semantics]: Returns the return type of __count__. The return type is always `int`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/query/count.hpp>
    #include <boost/fusion/include/count.hpp>

[endsect]

[section count_if]

[heading Description]
A metafunction that returns the result type of `count_if` given the sequence and predicate types.

[heading Synopsis]
    template<
        typename Sequence,
        typename Pred
        >
    struct count_if
    {
        typedef int type;
    };

[table Parameters
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`] [A model of __forward_sequence__] [Operation's argument]]
    [[`Pred`]     [A unary function object] [Operation's argument]]
]

[heading Expression Semantics]
    __result_of_count_if__<Sequence, Pred>::type

[*Return type]: `int`.

[*Semantics]: Returns the return type of __count_if__. The return type is always `int`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/query/count_if.hpp>
    #include <boost/fusion/include/count_if.hpp>

[endsect]

[endsect]

[endsect]

[section Transformation]
The transformation algorithms create new sequences out of existing sequences by performing some sort of transformation. In reality the new sequences are views onto the data in the original sequences.

[note As the transformation algorithms return views onto their input arguments,
it is important that the lifetime of the input arguments is greater than the
period during which you wish to use the results.]

[heading Header]

    #include <boost/fusion/algorithm/transformation.hpp>
    #include <boost/fusion/include/transformation.hpp>

[section Functions]

[section filter]

[heading Description]
For a given sequence, filter returns a new sequences containing only the elements of a specified type.

[heading Synopsis]
    template<
        typename T,
        typename Sequence
        >
    typename __result_of_filter__<Sequence const, T>::type filter(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`T`][Any type][The type to retain]]
]

[heading Expression Semantics]
    __filter__<T>(seq);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing all the elements of `seq` of type `T`.
Equivalent to `__filter_if__<boost::same_type<_, T> >(seq)`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/filter.hpp>
    #include <boost/fusion/include/filter.hpp>

[heading Example]
    const __vector__<int,int,long,long> vec(1,2,3,4);
    assert(__filter__<int>(vec) == __make_vector__(1,2));

[endsect]

[section filter_if]

[heading Description]
For a given sequence, __filter_if__ returns a new sequences containing
only the elements with types for which a given __mpl_lambda_expression__ evaluates to `boost::mpl::true_`.

[heading Synopsis]
    template<
        typename Pred,
        typename Sequence
        >
    typename __result_of_filter_if__<Sequence const, Pred>::type filter_if(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`Pred`][A unary __mpl_lambda_expression__][The predicate to filter by]]
]

[heading Expression Semantics]
    __filter_if__<Pred>(seq);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing all the elements of `seq` with types for which `Pred` evaluates
to `boost::mpl::true_`. The order of the retained elements is the same as in the original sequence.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/filter_if.hpp>
    #include <boost/fusion/include/filter_if.hpp>

[heading Example]
    const __vector__<int,int,double,double> vec(1,2,3.0,4.0);
    assert(__filter_if__<is_integral<mpl::_> >(vec) == __make_vector__(1,2));

[endsect]

[section transform]

[heading Description]
For a sequence `seq` and function object or function pointer `f`, `transform` returns a new sequence
with elements created by applying `f(e)` to each element of `e` of `seq`.

[heading Unary version synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_transform__<Sequence const, F>::type transform(
        Sequence const& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`f`][`f(e)` is a valid expression for each element `e` of `seq`. `__boost_result_of_call__<F(E)>::type` is the return type of `f` when called with a value of each element type `E`.][Transformation function]]
]

[heading Expression Semantics]
    __transform__(seq, f);

[*Return type]: A model of __forward_sequence__

[*Semantics]: Returns a new sequence, containing the return values of `f(e)` for each element `e` within `seq`.

[heading Binary version synopsis]
    template<
        typename Sequence1,
        typename Sequence2,
        typename F
        >
    typename __result_of_transform__<Sequence1 const, Sequence2 const, F>::type transform(
        Sequence1 const& seq1, Sequence2 const& seq2, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq1`][A model of __forward_sequence__][Operation's argument]]
    [[`seq2`][A model of __forward_sequence__][Operation's argument]]
    [[`f`][`f(e1,e2)` is a valid expression for each pair of elements `e1` of `seq1` and `e2` of `seq2`. `__boost_result_of_call__<F(E1,E2)>::type` is the return type of `f` when called with elements of type `E1` and `E2`][Transformation function]]
]

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns a new sequence, containing the return values of `f(e1, e2)` for each pair of elements `e1` and `e2` within `seq1` and `seq2` respectively.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/transform.hpp>
    #include <boost/fusion/include/transform.hpp>

[heading Example]
    struct triple
    {
        typedef int result_type;

        int operator()(int t) const
        {
            return t * 3;
        };
    };
    ...
    assert(__transform__(__make_vector__(1,2,3), triple()) == __make_vector__(3,6,9));

[endsect]

[section replace]

[heading Description]
Replaces each value within a sequence of a given type and value with a new value.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    typename __result_of_replace__<Sequence const, T>::type replace(
        Sequence const& seq, T const& old_value, T const& new_value);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__, `e == old_value` is a valid expression, convertible to `bool`, for each element `e` in `seq` with type convertible to `T`][Operation's argument]]
    [[`old_value`][Any type][Value to replace]]
    [[`new_value`][Any type][Replacement value]]
]

[heading Expression Semantics]
    __replace__(seq, old_value, new_value);

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns a new sequence with all the values of `seq` with `new_value` assigned to elements with the same type and equal to `old_value`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/replace.hpp>
    #include <boost/fusion/include/replace.hpp>

[heading Example]
    assert(__replace__(__make_vector__(1,2), 2, 3) == __make_vector__(1,3));

[endsect]

[section replace_if]

[heading Description]
Replaces each element of a given sequence for which an unary function object evaluates to `true` replaced with
a new value.

[heading Synopsis]
    template<
        typename Sequence,
        typename F,
        typename T>
    typename __result_of_replace_if__<Sequence const, F, T>::type replace_if(
        Sequence const& seq, F f, T const& new_value);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`f`][A function object for which `f(e)` is a valid expression, convertible to `bool`, for each element `e` in `seq`][Operation's argument]]
    [[`new_value`][Any type][Replacement value]]
]

[heading Expression Semantics]
    __replace_if__(seq, f, new_value);

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns a new sequence with all the elements of `seq`,
with `new_value` assigned to each element for which `f` evaluates to `true`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/replace_if.hpp>
    #include <boost/fusion/include/replace_if.hpp>

[heading Example]
    struct odd
    {
        template<typename T>
        bool operator()(T t) const
        {
            return t % 2;
        }
    };
    ...
    assert(__replace_if__(__make_vector__(1,2), odd(), 3) == __make_vector__(3,2));

[endsect]

[section remove]

[heading Description]
Returns a new sequence, with all the elements of the original sequence, except those of a given type.

[heading Synopsis]
    template<
        typename T,
        typename Sequence
        >
    typename __result_of_remove__<Sequence const, T>::type replace(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`T`][Any type][Type to remove]]
]

[heading Expression Semantics]
    __remove__<T>(seq);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, in their original order, except
those of type `T`. Equivalent to `__remove_if__<boost::is_same<_,T> >(seq)`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/remove.hpp>
    #include <boost/fusion/include/remove.hpp>

[heading Example]
    const __vector__<int,double> vec(1,2.0);
    assert(__remove__<double>(vec) == __make_vector__(1));

[endsect]

[section remove_if]

[heading Description]
Returns a new sequence, containing all the elements of the original except those where a given unary
function object evaluates to `true`.

[heading Synopsis]
    template<
        typename Pred,
        typename Sequence
        >
    typename __result_of_remove_if__<Sequence const, Pred>::type remove_if(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`Pred`][A model of unary __mpl_lambda_expression__][Removal predicate]]
]

[heading Expression Semantics]
    __remove_if__<Pred>(seq);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, in their original order, except
those elements with types for which `Pred` evaluates to `boost::mpl::true_`.
Equivalent to `__filter__<boost::mpl::not_<Pred> >(seq)`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/remove_if.hpp>
    #include <boost/fusion/include/remove_if.hpp>

[heading Example]
    const __vector__<int,double> vec(1,2.0);
    assert(__remove_if__<is_floating_point<mpl::_> >(vec) == __make_vector__(1));

[endsect]

[section reverse]

[heading Description]
Returns a new sequence with the elements of the original in reverse order.

[heading Synposis]
    template<
        typename Sequence
        >
    typename __result_of_reverse__<Sequence const>::type reverse(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __bidirectional_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __reverse__(seq);

[*Return type]:

* A model of __bidirectional_sequence__ if `seq` is a __bidirectional_sequence__
else, __random_access_sequence__ if `seq` is a __random_access_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence containing all the elements of `seq` in reverse order.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/reverse.hpp>
    #include <boost/fusion/include/reverse.hpp>

[heading Example]
    assert(__reverse__(__make_vector__(1,2,3)) == __make_vector__(3,2,1));

[endsect]

[section clear]

[heading Description]
__clear__ returns an empty sequence.

[heading Synposis]
    template<
        typename Sequence
        >
    typename __result_of_clear__<Sequence const>::type clear(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __clear__(seq);

[*Return type]: A model of __forward_sequence__.

[*Expression Semantics]: Returns a sequence with no elements.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/clear.hpp>
    #include <boost/fusion/include/clear.hpp>

[heading Example]
    assert(__clear__(__make_vector__(1,2,3)) == __make_vector__());

[endsect]

[section erase]

[heading Description]
Returns a new sequence, containing all the elements of the original except those at a specified iterator, or
between two iterators.

[heading Synposis]
    template<
        typename Sequence,
        typename First
        >
    typename __result_of_erase__<Sequence const, First>::type erase(
        Sequence const& seq, First const& it1);

    template<
        typename Sequence,
        typename First,
        typename Last
        >
    typename __result_of_erase__<Sequence const, First, Last>::type erase(
        Sequence const& seq, First const& it1, Last const& it2);

[table Parameters
    [[Parameters][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`it1`][A model of __forward_iterator__][Iterator into `seq`]]
    [[`it2`][A model of __forward_iterator__][Iterator into `seq` after `it1`]]
]

[heading Expression Semantics]
    __erase__(seq, pos);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence, containing all the elements of `seq` except the element at `pos`.

    __erase__(seq, first, last);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence, with all the elements of `seq`, in their original order, except those
in the range [`first`,`last`).

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/erase.hpp>
    #include <boost/fusion/include/erase.hpp>

[heading Example]
    const __vector__<int, double, char> vec(1, 2.0, 'c');
    assert(__erase__(vec, __next__(__begin__(vec))) == __make_vector__(1, 'c'));
    assert(__erase__(vec, __next__(__begin__(vec)), __end__(vec)) == __make_vector__(1));

[endsect]

[section erase_key]

[heading Description]
For an [link fusion.sequence.concepts.associative_sequence associative]] __forward_sequence__ `seq`,
returns a [link fusion.sequence.concepts.associative_sequence associative]] __forward_sequence__ containing
all the elements of the original except those with a given key.

[heading Synposis]
    template<
        typename Key,
        typename Sequence
        >
    typename __result_of_erase_key__<Sequence const, Key>::type erase_key(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__ and __associative_sequence__][Operation's argument]]
    [[`Key`][Any type][Key to erase]]
]

[heading Expression Semantics]
    __erase_key__<Key>(seq);

[*Return type]: A model of __forward_sequence__ and __associative_sequence__.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, except those with key `Key`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/erase_key.hpp>
    #include <boost/fusion/include/erase_key.hpp>

[heading Example]
    assert(__erase_key__<int>(__make_map__<int, long>('a', 'b')) == __make_map__<long>('b'));

[endsect]

[section insert]

[heading Description]
Returns a new sequence with all the elements of the original, an a new element inserted the
position described by a given iterator.

[heading Synposis]
    template<
        typename Sequence,
        typename Pos,
        typename T
        >
    typename __result_of_insert__<Sequence const, Pos, T>::type insert(
        Sequence const& seq, Pos const& pos, T const& t);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`pos`][A model of __forward_iterator__][The position to insert at]]
    [[`t`][Any type][The value to insert]]
]

[heading Expression Semantics]
    __insert__(seq, p, t);

[*Return type]:

* A model of __forward_sequence__.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, in their original order, and a new element with the
type and value of `t` inserted at iterator `pos`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/insert.hpp>
    #include <boost/fusion/include/insert.hpp>

[heading Example]
    const __vector__<int,int> vec(1,2);
    assert(__insert__(vec, __next__(__begin__(vec)), 3) == __make_vector__(1,3,2));

[endsect]

[section insert_range]

[heading Description]
Returns a new sequence with another sequence inserted at a specified iterator.

[heading Synposis]
    template<
        typename Sequence,
        typename Pos,
        typename Range
        >
    typename __result_of_insert_range__<Sequence const, Pos, Range>::type insert_range(
        Sequence const& seq, Pos const& pos, Range const& range);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`pos`][A model of __forward_iterator__][The position to insert at]]
    [[`range`][A model of __forward_sequence__][Range to insert]]
]

[heading Expression Semantics]
    __insert_range__(seq, pos, range);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, and the elements of
`range` inserted at iterator `pos`. All elements retaining their ordering from the orignal sequences.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/insert_range.hpp>
    #include <boost/fusion/include/insert_range.hpp>

[heading Example]
    const __vector__<int,int> vec(1,2);
    assert(__insert_range__(vec, __next__(__begin__(vec)), __make_vector__(3,4)) == __make_vector__(1,3,4,2));

[endsect]

[section join]

[heading Description]
Takes 2 sequences and returns a sequence containing the elements of the first followed by the elements of the second.

[heading Synopsis]
    template<
        typename LhSequence,
        typename RhSequence>
    typename __result_of_join__<LhSequence, RhSequence>::type join(LhSequence const& lhs, RhSequence const& rhs);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`lhs`][A model of __forward_sequence__][Operation's argument]]
    [[`rhs`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __join__(lhs, rhs);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `lhs` and `rhs` implement the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing all the elements of `lhs` followed by all the elements of `rhs`. The order of the elements is preserved.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/join.hpp>
    #include <boost/fusion/include/join.hpp>

[heading Example]
    __vector__<int,char> v1(1, 'a');
    __vector__<int,char> v2(2, 'b');
    assert(__join__(v1, v2) == __make_vector__(1,'a',2,'b'));

[endsect]

[section zip]

[heading Description]
Zips sequences together to form a single sequence, whos members are tuples of the members of the component sequences.

[heading Synopsis]
    template<
        typename Sequence1,
        typename Sequence2,
        ...
        typename SequenceN
        >
    typename __result_of_zip__<Sequence1, Sequence2, ... SequenceN>::type
    zip(Sequence1 const& seq1, Sequence2 const& seq2, ... SequenceN const& seqN);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq1` to `seqN`][Each sequence is a model of __forward_sequence__.][Operation's argument]]
]

[heading Expression Semantics]
    __zip__(seq1, seq2, ... seqN);

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns a sequence containing tuples of elements from sequences `seq1` to `seqN`. For example, applying zip to tuples `(1, 2, 3)` and `('a', 'b', 'c')` would return `((1, 'a'),(2, 'b'),(3, 'c'))`

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/zip.hpp>
    #include <boost/fusion/include/zip.hpp>

[heading Example]
    __vector__<int,char> v1(1, 'a');
    __vector__<int,char> v2(2, 'b');
    assert(__zip__(v1, v2) == __make_vector__(__make_vector__(1, 2),__make_vector__('a', 'b'));

[endsect]

[section pop_back]

[heading Description]
Returns a new sequence, with the last element of the original removed.

[heading Synopsis]
    template<
        typename Sequence
        >
    typename __result_of_pop_back__<Sequence const>::type pop_back(Sequence const& seq);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __pop_back__(seq);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence containing all the elements of `seq`, except the last element. The elements in the new sequence are in the same order as they were in `seq`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/pop_back.hpp>
    #include <boost/fusion/include/pop_back.hpp>

[heading Example]
    assert(___pop_back__(__make_vector__(1,2,3)) == __make_vector__(1,2));

[endsect]

[section pop_front]

[heading Description]
Returns a new sequence, with the first element of the original removed.

[heading Synopsis]
    template<
        typename Sequence
        >
    typename __result_of_pop_front__<Sequence const>::type pop_front(Sequence const& seq);


[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __pop_front__(seq);

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `seq` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence containing all the elements of `seq`, except the first element. The elements in the new sequence are in the same order as they were in `seq`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/pop_front.hpp>
    #include <boost/fusion/include/pop_front.hpp>

[heading Example]
    assert(__pop_front__(__make_vector__(1,2,3)) == __make_vector__(2,3));

[endsect]

[section push_back]

[heading Description]
Returns a new sequence with an element added at the end.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    typename __result_of_push_back__<Sequence, T>::type push_back(
        Sequence const& seq, T const& t);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`t`][Any type][The value to add to the end]]
]

[heading Expression Semantics]
    __push_back__(seq, t);

[*Return type]:

* A model of __forward_sequence__.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, and new element `t` appended to the end. The elements are in the same order as they were in `seq`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/push_back.hpp>
    #include <boost/fusion/include/push_back.hpp>

[heading Example]
    assert(__push_back__(__make_vector__(1,2,3),4) == __make_vector__(1,2,3,4));

[endsect]

[section push_front]

[heading Description]
Returns a new sequence with an element added at the beginning.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    typename __result_of_push_front__<Sequence, T>::type push_front(
        Sequence const& seq, T const& t);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`t`][Any type][The value to add to the beginning]]
]

[heading Expression Semantics]
    __push_back__(seq, t);

[*Return type]:

* A model of __forward_sequence__.

[*Semantics]: Returns a new sequence, containing all the elements of `seq`, and new element `t` appended to the beginning. The elements are in the same order as they were in `seq`.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/push_front.hpp>
    #include <boost/fusion/include/push_front.hpp>

[heading Example]
    assert(__push_front__(__make_vector__(1,2,3),0) == __make_vector__(0,1,2,3));

[endsect]

[endsect]

[section Metafunctions]

[section filter]

[heading Description]
Returns the result type of __filter__ given the sequence type and type to retain.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct filter
    {
        typedef __unspecified__ type;
    };

[table Parameter
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`][A model of __forward_sequence__] [Operation's argument]]
    [[`T`][Any type][Type to retain]]
]

[heading Expression Semantics]
    __result_of_filter__<Sequence, T>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing the elements of `Sequence` that are of type `T`. Equivalent to `__result_of_filter_if__<Sequence, boost::is_same<mpl::_, T> >::type`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/filter.hpp>
    #include <boost/fusion/include/filter.hpp>

[endsect]

[section filter_if]

[heading Description]
Returns the result type of __filter_if__ given the sequence and unary __mpl_lambda_expression__ predicate type.

[heading Synopsis]
    template<
        typename Sequence,
        typename Pred
        >
    struct filter_if
    {
        typedef __unspecified__ type;
    };

[table Parameter
    [[Parameter] [Requirement] [Description]]
    [[`Sequence`][A model of __forward_sequence__] [Operation's argument]]
    [[`Pred`][A unary __mpl_lambda_expression__][Type to retain]]
]

[heading Expression Semantics]
    __result_of_filter_if__<Sequence, Pred>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing the elements of `Sequence` for which `Pred` evaluates to `boost::mpl::true_`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/filter_if.hpp>
    #include <boost/fusion/include/filter_if.hpp>

[endsect]

[section transform]

[heading Description]
For a sequence `seq` and function object or function pointer `f`, `transform` returns a new sequence
with elements created by applying `f(e)` to each element of `e` of `seq`.

[heading Unary version synopsis]
    template<
        typename Sequence,
        typename F
        >
    typename __result_of_transform__<Sequence const, F>::type transform(
        Sequence const& seq, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq`][A model of __forward_sequence__][Operation's argument]]
    [[`f`][`f(e)` is a valid expression for each element `e` of `seq`. `__boost_result_of_call__<F(E)>::type` is the return type of `f` when called with a value of each element type `E`.][Transformation function]]
]

[heading Expression Semantics]
    __transform__(seq, f);

[*Return type]:

* A model of __forward_sequence__
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence, containing the return values of `f(e)` for each element `e` within `seq`.

[heading Binary version synopsis]
    template<
        typename Sequence1,
        typename Sequence2,
        typename F
        >
    typename __result_of_transform__<Sequence1 const, Sequence2 const, F>::type transform(
        Sequence1 const& seq1, Sequence2 const& seq2, F f);

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`seq1`][A model of __forward_sequence__][Operation's argument]]
    [[`seq2`][A model of __forward_sequence__][Operation's argument]]
    [[`f`][`f(e1,e2)` is a valid expression for each pair of elements `e1` of `seq1` and `e2` of `seq2`. `__boost_result_of_call__<F(E1,E2)>::type` is the return type of `f` when called with elements of type `E1` and `E2`][Transformation function]]
]

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns a new sequence, containing the return values of `f(e1, e2)` for each pair of elements `e1` and `e2` within `seq1` and `seq2` respectively.

[heading Complexity]
Constant. Returns a view which is lazily evaluated.

[heading Header]

    #include <boost/fusion/algorithm/transformation/transform.hpp>
    #include <boost/fusion/include/transform.hpp>

[heading Example]
    struct triple
    {
        typedef int result_type;

        int operator()(int t) const
        {
            return t * 3;
        };
    };
    ...
    assert(__transform__(__make_vector__(1,2,3), triple()) == __make_vector__(3,6,9));

[endsect]

[section replace]

[heading Description]
Returns the result type of __replace__, given the types of the input sequence and element to replace.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct replace
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`T`][Any type][The type of the search and replacement objects]]
]

[heading Expression Semantics]
    __result_of_replace__<Sequence,T>::type

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns the return type of __replace__.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/replace.hpp>
    #include <boost/fusion/include/replace.hpp>

[endsect]

[section replace_if]

[heading Description]
Returns the result type of __replace_if__, given the types of the sequence, __poly_func_obj__ predicate and replacement object.

[heading Synopsis]
    template<
        typename Sequence,
        typename F,
        typename T>
    struct replace_if
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`F`][A model of unary __poly_func_obj__][Replacement predicate]]
    [[`T`][Any type][The type of the replacement object]]
]

[heading Expression Semantics]
    __result_of_replace_if__<Sequence,F,T>::type

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns the return type of __replace_if__.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/replace_if.hpp>
    #include <boost/fusion/include/replace_if.hpp>

[endsect]

[section remove]

[heading Description]
Returns the result type of __remove__, given the sequence and removal types.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct remove
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`T`][Any type][Remove elements of this type]]
]

[heading Expression Semantics]
    __result_of_remove__<Sequence, T>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing the elements of `Sequence` not of type `T`. Equivalent to `__result_of_replace_if__<Sequence, boost::is_same<mpl::_, T> >::type`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/remove.hpp>
    #include <boost/fusion/include/remove.hpp>

[endsect]

[section remove_if]

[heading Description]
Returns the result type of __remove_if__, given the input sequence and unary __mpl_lambda_expression__ predicate types.

[heading Synopsis]
    template<
        typename Sequence,
        typename Pred
        >
    struct remove_if
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`Pred`][A model of unary __mpl_lambda_expression__][Remove elements which evaluate to `boost::mpl::true_`]]
]

[heading Expression Semantics]
    __result_of_remove_if__<Sequence, Pred>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing the elements of `Sequence` for which `Pred` evaluates to `boost::mpl::false_`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/remove_if.hpp>
    #include <boost/fusion/include/remove_if.hpp>

[endsect]

[section reverse]

[heading Description]
Returns the result type of __reverse__, given the input sequence type.

[heading Synopsis]
    template<
        typename Sequence
        >
    struct reverse
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __bidirectional_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_reverse__<Sequence>::type

[*Return type]:

* A model of __bidirectional_sequence__ if `Sequence` is a __bidirectional_sequence__
else, __random_access_sequence__ if `Sequence` is a __random_access_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence with the elements in the reverse order to `Sequence`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/reverse.hpp>
    #include <boost/fusion/include/reverse.hpp>

[endsect]

[section clear]

[heading Description]
Returns the result type of __clear__, given the input sequence type.

[heading Synopsis]
    template<
        typename Sequence
        >
    struct clear
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][Any type][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_clear__<Sequence>::type

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns an empty sequence.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/clear.hpp>
    #include <boost/fusion/include/clear.hpp>

[endsect]

[section erase]
Returns the result type of __erase__, given the input sequence and range delimiting iterator types.

[heading Description]

[heading Synopsis]
    template<
        typename Sequence,
        typename It1,
        typename It2 = __unspecified__>
    struct erase
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`It1`][A model of __forward_iterator__][Operation's argument]]
    [[`It2`][A model of __forward_iterator__][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_erase__<Sequence, It1>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a new sequence with the element at `It1` removed.

    __result_of_erase__<Sequence, It1, It2>::type

[*Return type]: A model of __forward_sequence__.

[*Semantics]: Returns a new sequence with the elements between `It1` and `It2` removed.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/erase.hpp>
    #include <boost/fusion/include/erase.hpp>

[endsect]

[section erase_key]

[heading Description]
Returns the result type of __erase_key__, given the sequence and key types.

[heading Synopsis]
    template<
        typename Sequence,
        typename Key
        >
    struct erase_key
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__ and __associative_sequence__][Operation's argument]]
    [[`Key`][Any type][Key type]]
]

[heading Expression Semantics]
    __result_of_erase_key__<Sequence, Key>::type

[*Return type]: A model of __forward_sequence__ and __associative_sequence__.

[*Semantics]: Returns a sequence with the elements of `Sequence`, except those with key `Key`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/erase_key.hpp>
    #include <boost/fusion/include/erase_key.hpp>

[endsect]

[section insert]

[heading Description]
Returns the result type of __insert__, given the sequence, position iterator and insertion types.

[heading Synopsis]
    template<
        typename Sequence,
        typename Position,
        typename T
        >
    struct insert
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`Position`][A model of __forward_iterator__][Operation's argument]]
    [[`T`][Any type][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_insert__<Sequence, Position, T>::type

[*Return type]:

* A model of __forward_sequence__.

[*Semantics]: Returns a sequence with an element of type `T` inserted at position `Position` in `Sequence`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/insert.hpp>
    #include <boost/fusion/include/insert.hpp>

[endsect]

[section insert_range]

[heading Description]
Returns the result type of __insert_range__, given the input sequence, position iterator and insertion range types.

[heading Synopsis]
    template<
        typename Sequence,
        typename Position,
        typename Range
        >
    struct insert_range
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`Position`][A model of __forward_iterator__][Operation's argument]]
    [[`Range`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_insert_range__<Sequence, Position, Range>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence with the elements of `Range` inserted at position `Position` into `Sequence`.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/insert_range.hpp>
    #include <boost/fusion/include/insert_range.hpp>

[endsect]

[section join]

[heading Description]
Returns the result of joining 2 sequences, given the sequence types.

[heading Synopsis]
    template<
        typename LhSequence,
        typename RhSequence
        >
    struct join
    {
        typedef __unspecified__ type;
    };

[heading Expression Semantics]
    __result_of_join__<LhSequence, RhSequence>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `LhSequence` amd `RhSequence` implement the __associative_sequence__ model.

[*Semantics]: Returns a sequence containing the elements of `LhSequence` followed by the elements of `RhSequence`. The order of the elements in the 2 sequences is preserved.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/join.hpp>
    #include <boost/fusion/include/join.hpp>

[endsect]

[section zip]

[heading Description]
Zips sequences together to form a single sequence, whos members are tuples of the members of the component sequences.

[heading Synopsis]
    template<
        typename Sequence1,
        typename Sequence2,
        ...
        typename SequenceN
        >
    struct zip
    {
        typedef __unspecified__ type;
    };

[heading Expression Semantics]
    __result_of_zip__<Sequence1, Sequence2, ... SequenceN>::type

[*Return type]: A model of the most restrictive traversal category of sequences `Sequence1` to `SequenceN`.

[*Semantics]: Return a sequence containing tuples of elements from each sequence. For example, applying zip to tuples `(1, 2, 3)` and `('a', 'b', 'c')` would return `((1, 'a'),(2, 'b'),(3, 'c'))`

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/zip.hpp>
    #include <boost/fusion/include/zip.hpp>

[endsect]

[section pop_back]

[heading Description]
Returns the result type of __pop_back__, given the input sequence type.

[heading Synopsis]
    template<
        typename Sequence
        >
    struct pop_back
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_pop_back__<Sequence>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence with all the elements of `Sequence` except the last element.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/pop_back.hpp>
    #include <boost/fusion/include/pop_back.hpp>

[endsect]

[section pop_front]

[heading Description]
Returns the result type of __pop_front__, given the input sequence type.

[heading Synopsis]
    template<
        typename Sequence
        >
    struct pop_front
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_pop_front__<Sequence>::type

[*Return type]:

* A model of __forward_sequence__.
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.

[*Semantics]: Returns a sequence with all the elements of `Sequence` except the first element.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/pop_front.hpp>
    #include <boost/fusion/include/pop_front.hpp>

[endsect]

[section push_back]

[heading Description]
Returns the result type of __push_back__, given the types of the input sequence and element to push.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct push_back
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`T`][Any type][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_push_back__<Sequence, T>::type

[*Return type]:

* A model of __forward_sequence__.

[*Semantics]: Returns a sequence with the elements of `Sequence` and an element of type `T` added to the end.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/push_back.hpp>
    #include <boost/fusion/include/push_back.hpp>

[endsect]

[section push_front]

[heading Description]
Returns the result type of __push_front__, given the types of the input sequence and element to push.

[heading Synopsis]
    template<
        typename Sequence,
        typename T
        >
    struct push_front
    {
        typedef __unspecified__ type;
    };

[table Parameters
    [[Parameter][Requirement][Description]]
    [[`Sequence`][A model of __forward_sequence__][Operation's argument]]
    [[`T`][Any type][Operation's argument]]
]

[heading Expression Semantics]
    __result_of_push_front__<Sequence, T>::type

[*Return type]:

* A model of __forward_sequence__.

[*Semantics]: Returns a sequence with the elements of `Sequence` and an element of type `T` added to the beginning.

[heading Complexity]
Constant.

[heading Header]

    #include <boost/fusion/algorithm/transformation/push_front.hpp>
    #include <boost/fusion/include/push_front.hpp>

[endsect]

[endsect]

[endsect]

[endsect]