Knowledge

Variadic template

Source 📝

317:(...) operator has two roles. When it occurs to the left of the name of a parameter, it declares a parameter pack. Using the parameter pack, the user can bind zero or more arguments to the variadic template parameters. Parameter packs can also be used for non-type parameters. By contrast, when the ellipsis operator occurs to the right of a template or function call argument, it unpacks the parameter packs into separate arguments, like the 51:
The variadic template feature of C++ was designed by Douglas Gregor and Jaakko Järvi and was later standardized in C++11. Prior to C++11, templates (classes and functions) could only take a fixed number of arguments, which had to be specified when a template was first declared. C++11 allows template
1013:
calls will be executed in an unspecified order, because the order of evaluation of function arguments is undefined. To avoid the unspecified order, brace-enclosed initializer lists can be used, which guarantee strict left-to-right order of evaluation. An initializer list requires a
2093:
This structure allows one to manipulate a list of variadic arguments that will auto-expand. The arguments must either be symbols or values known at compile time. This includes values, types, functions or even non-specialized templates. This allows any operation you would expect:
1513:
syntax perfectly forwards arguments as their proper types, even with regard to rvalue-ness, to the constructor. The unpack operator will propagate the forwarding syntax to each parameter. This particular factory function automatically wraps the allocated memory in a
787:
There is no simple mechanism to iterate over the values of the variadic template. However, there are several ways to translate the argument pack into a single argument that can be evaluated separately for each parameter. Usually this will rely on
325:
below. In practice, the use of an ellipsis operator in the code causes the whole expression that precedes the ellipsis to be repeated for every subsequent argument unpacked from the argument pack, with the expressions separated by commas.
329:
The use of variadic templates is often recursive. The variadic parameters themselves are not readily available to the implementation of a function or class. Therefore, the typical mechanism for defining something like a C++11 variadic
245:
Variadic templates may also apply to functions, thus not only providing a type-safe add-on to variadic functions (such as printf), but also allowing a function called with printf-like syntax to process non-trivial objects.
1115:
the argument pack, whereas the other receives neither. (If both had the same list of initial parameters, the call would be ambiguous — a variadic parameter pack alone cannot disambiguate a call.) For example:
996:
The use of this "pass" function is necessary, since the expansion of the argument pack proceeds by separating the function call arguments by commas, which are not equivalent to the comma operator. Therefore,
1110:
Another way is to use overloading with "termination versions" of functions. This is more universal, but requires a bit more code and more effort to create. One function receives one argument of some type
1244:
contains at least one argument, it will redirect to the second version — a parameter pack can be empty, in which case it will simply redirect to the termination version, which will do nothing.
1247:
Variadic templates can also be used in an exception specification, a base class list, or the initialization list of a constructor. For example, a class can specify the following:
1345:, such that this class will be derived from each of the types passed in. Also, the constructor must take a reference to each base class, so as to initialize the base classes of 1352:
With regard to function templates, the variadic parameters can be forwarded. When combined with universal references (see above), this allows for perfect forwarding:
1098:
Instead of executing a function, a lambda expression may be specified and executed in place, which allows executing arbitrary sequences of statements in-place.
2566:
Douglas Gregor; Jaakko Järvi & Gary Powell. (February 2004). "Variadic templates. Number N1603=04-0043 in ISO C++ Standard Committee Pre-Sydney mailing".
93:
will take any number of typenames as its template parameters. Here, an instance of the above template class is instantiated with three type arguments:
2126:// Note: AliasSeq can't be modified, and an alias can't be rebound, so we'll need to define new names for our modifications. 1697:
Variadic arguments are very similar to constant array in their usage. They can be iterated upon, accessed by an index, have a
1705:. Operations are interpreted at compile time, which means operands can't be runtime value (such as function parameters). 1104:
However, in this particular example, a lambda function is not necessary. A more ordinary expression can be used instead:
1708:
Anything which is known at compile time can be passed as a variadic arguments. It makes variadic arguments similar to
314: 2600: 199:
If the variadic template should only allow a positive number of arguments, then this definition can be used:
2366:// std.meta provides templates to work with AliasSeq, such as anySatisfy, allSatisfy, staticMap, and Filter. 666:// pretend to parse the format: only works on 2-character format strings ( %d, %f, etc ); fails with %5.4f 2580: 40: 1521:
Additionally, the number of arguments in a template parameter pack can be determined as follows:
792:, or — if the function can simply pick one argument at a time — using a dumb expansion marker: 25: 789: 17: 8: 702:// called even when *s is 0 but does nothing in that case (and ignores extra arguments) 2518: 1715:
Here is an example that prints the string representation of the variadic parameters.
1702: 1001:
will never work. Moreover, the solution above will only work when the return type of
2585: 2548: 1709: 2059: 2049:"Hello world"uintDummy42s_int "Hello world"uintDummy42s_int 2527: 2523: 1606:
The definition of variadic templates in D is similar to their C++ counterpart:
2594: 1712:, but more powerful, as they also accept basic types (char, short, int...). 1509:
This unpacks the argument list into the constructor of TypeToConstruct. The
776:
This is a recursive template. Notice that the variadic template version of
2058:
Variadic templates are often used to create a sequence of aliases, named
2565: 1341:
The unpack operator will replicate the types for the base classes of
1101:
pass{((){ std::cout << args << std::endl; }(), 1)...};
2062:. The definition of an AliasSeq is actually very straightforward: 52:
definitions to take an arbitrary number of arguments of any type.
36: 32: 2546: 1107:
pass{(std::cout << args << std::endl, 1)...};
2514:
For articles on variadic constructs other than templates
1018:
return type, but the comma operator can be used to yield
1637:
Likewise, any argument can precede the argument list:
2581:
Working draft for the C++ language, January 16, 2012
1518:
for a degree of safety with regard to memory leaks.
471:"invalid format string: missing arguments" 2547:Douglas Gregor & Jaakko Järvi (February 2008). 2592: 28:that take a variable number of arguments. 181:The number of arguments can be zero, so 2593: 941:which will expand to something like: 1587:SomeStruct<Type1, Type2>::size 780:calls itself, or (in the event that 31:Variadic templates are supported by 1232:// note: arg1 does not appear here! 13: 14: 2612: 2574: 334:replacement would be as follows: 2586:Variadic Templates in D language 1511:std::forward<Args>(params) 1720: 1716: 1698: 1590: 1586: 1515: 1510: 1346: 1342: 1241: 1019: 1015: 1010: 1006: 1002: 998: 784:is empty) calls the base case. 781: 777: 331: 322: 318: 182: 90: 84:// takes zero or more arguments 2559: 2549:"Variadic Templates for C++0x" 2540: 1692: 841:which can be used as follows: 240:// takes one or more arguments 1: 2533: 1601: 2553:Journal of Object Technology 1022:for each expansion element. 7: 2509: 2053: 10: 2617: 2237:// AliasSeq auto expansion 1417:construct_with_shared_ptr 89:The above template class 2096: 2064: 2047: 1725: 1710:template alias arguments 1639: 1608: 1591:SomeStruct<>::size 1523: 1354: 1249: 1118: 1024: 943: 843: 794: 336: 248: 201: 95: 54: 1827:"Hello world" 1779:"Hello world" 1723:produce equal results. 999:some_function(args)...; 1133:// termination version 46: 41:D programming language 1701:property, and can be 2601:Computer programming 1596: 1589:will yield 2, while 790:function overloading 18:computer programming 1009:. Furthermore, the 39:standard), and the 1375:SharedPtrAllocator 927:"answer" 681:// print the value 190:some_instance_name 173:some_instance_name 22:variadic templates 2555:. pp. 31–51. 2519:Variadic function 2608: 2568: 2567: 2563: 2557: 2556: 2544: 2505: 2502: 2499: 2496: 2493: 2490: 2487: 2484: 2481: 2478: 2475: 2472: 2469: 2466: 2463: 2460: 2457: 2454: 2451: 2448: 2445: 2442: 2439: 2436: 2433: 2430: 2427: 2424: 2421: 2418: 2415: 2412: 2409: 2406: 2403: 2400: 2397: 2394: 2391: 2388: 2385: 2382: 2379: 2376: 2373: 2370: 2367: 2364: 2361: 2358: 2355: 2352: 2349: 2346: 2343: 2340: 2337: 2334: 2331: 2328: 2325: 2322: 2319: 2316: 2313: 2310: 2307: 2304: 2301: 2298: 2295: 2292: 2289: 2286: 2283: 2280: 2277: 2274: 2271: 2268: 2265: 2262: 2259: 2256: 2253: 2250: 2247: 2244: 2241: 2238: 2235: 2232: 2229: 2226: 2223: 2220: 2217: 2214: 2211: 2208: 2205: 2202: 2199: 2196: 2193: 2190: 2187: 2184: 2181: 2178: 2175: 2172: 2169: 2166: 2163: 2160: 2157: 2154: 2151: 2148: 2145: 2142: 2139: 2136: 2133: 2130: 2127: 2124: 2121: 2118: 2115: 2112: 2109: 2106: 2103: 2100: 2089: 2086: 2083: 2080: 2077: 2074: 2071: 2068: 2041: 2038: 2035: 2032: 2029: 2026: 2023: 2020: 2017: 2014: 2011: 2008: 2005: 2002: 1999: 1996: 1993: 1990: 1987: 1984: 1981: 1978: 1975: 1972: 1969: 1966: 1963: 1960: 1957: 1954: 1951: 1948: 1945: 1942: 1939: 1936: 1933: 1930: 1927: 1924: 1921: 1918: 1915: 1912: 1909: 1906: 1903: 1900: 1897: 1894: 1891: 1888: 1885: 1882: 1879: 1876: 1873: 1870: 1867: 1864: 1861: 1858: 1855: 1852: 1849: 1846: 1843: 1840: 1837: 1834: 1831: 1828: 1825: 1822: 1819: 1816: 1813: 1810: 1807: 1804: 1801: 1798: 1795: 1792: 1789: 1786: 1783: 1780: 1777: 1774: 1771: 1768: 1765: 1762: 1759: 1756: 1753: 1750: 1747: 1744: 1741: 1738: 1735: 1732: 1729: 1722: 1718: 1700: 1688: 1685: 1682: 1679: 1676: 1673: 1670: 1667: 1664: 1661: 1658: 1655: 1652: 1649: 1646: 1645:VariadicTemplate 1643: 1633: 1630: 1627: 1624: 1621: 1618: 1615: 1614:VariadicTemplate 1612: 1592: 1588: 1581: 1578: 1575: 1572: 1569: 1566: 1563: 1560: 1557: 1554: 1551: 1548: 1545: 1542: 1539: 1536: 1533: 1530: 1527: 1517: 1512: 1505: 1502: 1499: 1496: 1493: 1490: 1487: 1484: 1481: 1478: 1475: 1472: 1469: 1466: 1463: 1460: 1457: 1454: 1451: 1448: 1445: 1442: 1439: 1436: 1433: 1430: 1427: 1424: 1421: 1418: 1415: 1412: 1409: 1406: 1403: 1400: 1397: 1394: 1391: 1388: 1385: 1382: 1379: 1376: 1373: 1370: 1367: 1364: 1361: 1358: 1348: 1344: 1337: 1334: 1331: 1328: 1325: 1322: 1319: 1316: 1313: 1310: 1307: 1304: 1301: 1298: 1295: 1292: 1289: 1286: 1283: 1280: 1277: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1243: 1236: 1233: 1230: 1227: 1224: 1221: 1218: 1215: 1212: 1209: 1206: 1203: 1200: 1197: 1194: 1191: 1188: 1185: 1182: 1179: 1176: 1173: 1170: 1167: 1164: 1161: 1158: 1155: 1152: 1149: 1146: 1143: 1140: 1137: 1134: 1131: 1128: 1125: 1122: 1094: 1091: 1088: 1085: 1082: 1079: 1076: 1073: 1070: 1067: 1064: 1061: 1058: 1055: 1052: 1049: 1046: 1043: 1040: 1037: 1034: 1031: 1028: 1021: 1017: 1012: 1008: 1004: 1000: 992: 989: 986: 983: 980: 977: 974: 971: 968: 965: 962: 959: 956: 953: 950: 947: 937: 934: 931: 928: 925: 922: 919: 916: 913: 910: 907: 904: 901: 898: 895: 892: 889: 886: 883: 880: 877: 874: 871: 868: 865: 862: 859: 856: 853: 850: 847: 837: 834: 831: 828: 825: 822: 819: 816: 813: 810: 807: 804: 801: 798: 783: 779: 772: 769: 766: 763: 760: 757: 754: 751: 748: 745: 742: 739: 736: 733: 730: 727: 724: 721: 718: 715: 712: 709: 706: 703: 700: 697: 694: 691: 688: 685: 682: 679: 676: 673: 670: 667: 664: 661: 658: 655: 652: 649: 646: 643: 640: 637: 634: 631: 628: 625: 622: 619: 616: 613: 610: 607: 604: 601: 598: 595: 592: 589: 586: 583: 580: 577: 574: 571: 568: 565: 562: 559: 556: 553: 550: 547: 544: 541: 538: 535: 532: 529: 526: 523: 520: 517: 514: 511: 508: 505: 502: 499: 496: 493: 490: 487: 484: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 343: 340: 333: 324: 320: 309: 306: 303: 300: 297: 294: 291: 288: 285: 282: 279: 276: 273: 270: 267: 264: 261: 258: 255: 252: 241: 238: 235: 232: 229: 226: 223: 220: 217: 214: 211: 208: 205: 196:will also work. 195: 194: 191: 188: 185: 177: 174: 171: 168: 165: 162: 159: 156: 153: 150: 147: 144: 141: 138: 135: 132: 129: 126: 123: 120: 117: 114: 111: 108: 105: 102: 99: 92: 85: 82: 79: 76: 73: 70: 67: 64: 61: 58: 2616: 2615: 2611: 2610: 2609: 2607: 2606: 2605: 2591: 2590: 2577: 2572: 2571: 2564: 2560: 2545: 2541: 2536: 2512: 2507: 2506: 2503: 2500: 2497: 2494: 2491: 2488: 2485: 2482: 2479: 2476: 2473: 2470: 2467: 2464: 2461: 2458: 2455: 2452: 2449: 2446: 2443: 2440: 2437: 2434: 2431: 2428: 2425: 2422: 2419: 2416: 2413: 2410: 2407: 2404: 2401: 2398: 2395: 2392: 2389: 2386: 2383: 2380: 2377: 2374: 2371: 2368: 2365: 2362: 2359: 2356: 2353: 2350: 2347: 2344: 2341: 2338: 2335: 2332: 2329: 2326: 2323: 2320: 2317: 2314: 2311: 2308: 2305: 2302: 2299: 2296: 2293: 2290: 2287: 2284: 2281: 2278: 2275: 2272: 2269: 2266: 2263: 2260: 2257: 2254: 2251: 2248: 2245: 2242: 2239: 2236: 2233: 2230: 2227: 2224: 2221: 2218: 2215: 2212: 2209: 2206: 2203: 2200: 2197: 2194: 2191: 2188: 2185: 2182: 2179: 2176: 2173: 2170: 2167: 2164: 2161: 2158: 2155: 2152: 2149: 2146: 2143: 2140: 2137: 2134: 2131: 2128: 2125: 2122: 2119: 2116: 2113: 2110: 2107: 2104: 2101: 2098: 2091: 2090: 2087: 2084: 2081: 2078: 2075: 2072: 2069: 2066: 2056: 2051: 2050: 2043: 2042: 2039: 2036: 2033: 2030: 2027: 2024: 2021: 2018: 2015: 2012: 2009: 2006: 2003: 2000: 1997: 1994: 1991: 1988: 1985: 1982: 1979: 1976: 1973: 1970: 1967: 1964: 1961: 1958: 1955: 1952: 1949: 1946: 1943: 1940: 1937: 1934: 1931: 1928: 1925: 1922: 1919: 1916: 1913: 1910: 1907: 1904: 1901: 1898: 1895: 1892: 1889: 1886: 1883: 1880: 1877: 1874: 1871: 1868: 1865: 1862: 1859: 1856: 1853: 1850: 1847: 1844: 1841: 1838: 1835: 1832: 1829: 1826: 1823: 1820: 1817: 1814: 1811: 1808: 1805: 1802: 1799: 1796: 1793: 1790: 1787: 1784: 1781: 1778: 1775: 1772: 1769: 1766: 1763: 1760: 1757: 1754: 1751: 1748: 1745: 1742: 1739: 1736: 1733: 1730: 1727: 1695: 1690: 1689: 1686: 1683: 1680: 1677: 1674: 1671: 1668: 1665: 1662: 1659: 1656: 1653: 1650: 1647: 1644: 1641: 1635: 1634: 1631: 1628: 1625: 1622: 1619: 1616: 1613: 1610: 1604: 1599: 1585:The expression 1583: 1582: 1579: 1576: 1573: 1570: 1567: 1564: 1561: 1558: 1555: 1552: 1549: 1546: 1543: 1540: 1537: 1534: 1531: 1528: 1525: 1516:std::shared_ptr 1507: 1506: 1503: 1500: 1497: 1494: 1491: 1488: 1485: 1482: 1479: 1476: 1473: 1470: 1468:TypeToConstruct 1467: 1464: 1461: 1458: 1456:TypeToConstruct 1455: 1452: 1449: 1446: 1443: 1440: 1437: 1434: 1431: 1428: 1425: 1422: 1419: 1416: 1413: 1411:TypeToConstruct 1410: 1407: 1404: 1401: 1398: 1395: 1392: 1389: 1386: 1383: 1380: 1377: 1374: 1371: 1368: 1366:TypeToConstruct 1365: 1362: 1359: 1356: 1339: 1338: 1335: 1332: 1329: 1326: 1323: 1320: 1317: 1314: 1311: 1308: 1305: 1302: 1299: 1296: 1293: 1290: 1287: 1284: 1281: 1278: 1275: 1272: 1269: 1266: 1263: 1260: 1257: 1254: 1251: 1238: 1237: 1234: 1231: 1228: 1225: 1222: 1219: 1216: 1213: 1210: 1207: 1204: 1201: 1198: 1195: 1192: 1189: 1186: 1183: 1180: 1177: 1174: 1171: 1168: 1165: 1162: 1159: 1156: 1153: 1150: 1147: 1144: 1141: 1138: 1135: 1132: 1129: 1126: 1123: 1120: 1108: 1102: 1096: 1095: 1092: 1089: 1086: 1083: 1080: 1077: 1074: 1071: 1068: 1065: 1062: 1059: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1035: 1032: 1029: 1026: 994: 993: 990: 987: 984: 981: 978: 975: 972: 969: 966: 963: 960: 957: 954: 951: 948: 945: 939: 938: 935: 932: 929: 926: 923: 920: 917: 914: 911: 908: 905: 902: 899: 896: 893: 890: 887: 884: 881: 878: 875: 872: 869: 866: 863: 860: 857: 854: 851: 848: 845: 839: 838: 835: 832: 829: 826: 823: 820: 817: 814: 811: 808: 805: 802: 799: 796: 774: 773: 770: 767: 764: 761: 758: 755: 752: 749: 746: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 710: 707: 704: 701: 698: 695: 692: 689: 686: 683: 680: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 632: 629: 626: 623: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 542: 539: 536: 533: 530: 527: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 321:in the body of 311: 310: 307: 304: 301: 298: 295: 292: 289: 286: 283: 280: 277: 274: 271: 268: 265: 262: 259: 256: 253: 250: 243: 242: 239: 236: 233: 230: 227: 224: 221: 218: 215: 212: 209: 206: 203: 192: 189: 186: 183: 179: 178: 175: 172: 169: 166: 163: 160: 157: 154: 151: 148: 145: 142: 139: 136: 133: 130: 127: 124: 121: 118: 115: 112: 109: 106: 103: 100: 97: 87: 86: 83: 80: 77: 74: 71: 68: 65: 62: 59: 56: 49: 12: 11: 5: 2614: 2604: 2603: 2589: 2588: 2583: 2576: 2575:External links 2573: 2570: 2569: 2558: 2538: 2537: 2535: 2532: 2531: 2530: 2528:C preprocessor 2524:Variadic macro 2521: 2511: 2508: 2097: 2065: 2055: 2052: 2048: 1726: 1694: 1691: 1640: 1609: 1603: 1600: 1598: 1595: 1524: 1355: 1250: 1119: 1106: 1100: 1025: 944: 844: 795: 337: 249: 202: 96: 55: 48: 45: 9: 6: 4: 3: 2: 2613: 2602: 2599: 2598: 2596: 2587: 2584: 2582: 2579: 2578: 2562: 2554: 2550: 2543: 2539: 2529: 2525: 2522: 2520: 2517: 2516: 2515: 2095: 2063: 2061: 2046: 1724: 1713: 1711: 1706: 1704: 1638: 1607: 1594: 1593:will give 0. 1522: 1519: 1353: 1350: 1248: 1245: 1117: 1114: 1105: 1099: 1078:some_function 1023: 1011:some_function 1003:some_function 976:some_function 964:some_function 952:some_function 942: 900:some_function 842: 793: 791: 785: 465:runtime_error 335: 327: 316: 247: 200: 197: 94: 53: 44: 42: 38: 34: 29: 27: 23: 19: 2561: 2552: 2542: 2513: 2092: 2057: 2044: 1998:"" 1935:"" 1714: 1707: 1696: 1636: 1605: 1584: 1520: 1508: 1351: 1340: 1327:base_classes 1312:base_classes 1246: 1239: 1112: 1109: 1103: 1097: 995: 988:/* etc... */ 940: 840: 786: 775: 510:// recursive 339:// base case 328: 312: 244: 198: 180: 170:>>> 88: 50: 30: 21: 15: 2405:evenNumbers 2372:evenNumbers 1693:Basic usage 1321:BaseClasses 1303:BaseClasses 1282:BaseClasses 1264:BaseClasses 657:'%' 621:'%' 438:'%' 402:'%' 35:(since the 2534:References 2180:// Slicing 1684:/* Body */ 1629:/* Body */ 1602:Definition 1547:SomeStruct 1450:shared_ptr 1426:&& 1405:shared_ptr 1306:&& 1193:&& 879:&& 830:&& 305:parameters 293:str_format 2045:Outputs: 2028:StringOf2 2010:StringOf2 1992:StringOf2 1947:StringOf2 1821:StringOf2 1721:StringOf2 1347:ClassName 1343:ClassName 1297:ClassName 1273:ClassName 778:my_printf 705:my_printf 543:my_printf 345:my_printf 272:my_printf 26:templates 2595:Category 2510:See also 2450:template 2411:AliasSeq 2300:AliasSeq 2249:AliasSeq 2213:AliasSeq 2207:lastHalf 2186:lastHalf 2138:AliasSeq 2070:AliasSeq 2060:AliasSeq 2054:AliasSeq 2022:stringof 1944:template 1929:StringOf 1917:StringOf 1914:template 1899:StringOf 1893:stringof 1881:StringOf 1863:StringOf 1860:template 1773:StringOf 1717:StringOf 1642:template 1611:template 1532:typename 1526:template 1387:typename 1381:template 1363:typename 1357:template 1258:typename 1252:template 1151:typename 1142:typename 1136:template 1042:typename 1036:template 852:typename 846:template 803:typename 797:template 753:<< 693:<< 528:typename 519:typename 513:template 489:<< 315:ellipsis 257:typename 251:template 219:typename 210:typename 204:template 187:<> 63:typename 57:template 2526:in the 2261:numbers 2192:numbers 2132:numbers 1498:)...)); 1480:forward 1242:args... 1208:process 1005:is not 782:args... 319:args... 2492:number 2474:isEven 2462:number 2453:isEven 2399:assert 2396:static 2390:digits 2384:isEven 2378:Filter 2294:digits 2288:assert 2285:static 2243:digits 2201:assert 2198:static 2099:import 1977:length 1962:static 1809:pragma 1761:pragma 1740:struct 1728:static 1703:sliced 1699:length 1669:symbol 1657:string 1568:sizeof 1553:static 1544:struct 1495:params 1441:return 1432:params 1372:struct 1291:public 1279:public 1093:)...}; 1027:struct 915:expand 909:)...); 870:expand 864:inline 815:inline 723:return 332:printf 323:printf 299:Params 287:string 263:Params 161:vector 149:string 116:vector 69:Values 2369:alias 2240:alias 2183:alias 2129:alias 2067:alias 1851:s_int 1839:Dummy 1803:s_int 1791:Dummy 1743:Dummy 1734:s_int 1666:alias 1660:value 1556:const 1270:class 1229:...); 1187:const 1178:& 1172:const 720:...); 696:value 588:while 567:value 549:const 456:throw 369:while 351:const 290:& 278:const 234:tuple 231:class 213:First 184:tuple 98:tuple 91:tuple 78:tuple 75:class 37:C++11 2471:enum 2117:main 2114:void 2108:meta 2085:Args 2079:...) 2076:Args 2034:Args 2016:Args 2007:enum 2004:else 1989:enum 1971:Args 1956:...) 1953:Args 1926:enum 1905:Args 1887:Args 1878:enum 1872:...) 1869:Args 1833:uint 1785:uint 1752:main 1749:void 1719:and 1678:...) 1675:Args 1623:...) 1620:Args 1574:Args 1571:...( 1562:size 1541:> 1538:Args 1529:< 1489:> 1486:Args 1483:< 1459:> 1453:< 1423:Args 1414:> 1408:< 1396:> 1393:Args 1384:< 1369:> 1360:< 1330:)... 1267:> 1255:< 1226:args 1220:func 1214:arg1 1199:args 1190:Args 1181:arg1 1175:Arg1 1166:func 1163:void 1160:> 1157:Args 1145:Arg1 1139:< 1124:func 1121:void 1084:args 1072:pass 1063:...) 1054:pass 1051:> 1039:< 1030:pass 1016:void 1014:non- 1007:void 982:arg3 970:arg2 958:arg1 946:pass 933:true 906:args 894:pass 885:args 876:Args 867:void 861:> 858:Args 849:< 833:...) 827:Args 821:pass 818:void 812:> 809:Args 800:< 750:cout 717:args 690:cout 579:args 573:Args 552:char 540:void 537:> 534:Args 516:< 486:cout 453:else 354:char 342:void 313:The 269:void 266:> 254:< 228:> 225:Rest 207:< 164:< 140:< 125:> 119:< 101:< 72:> 60:< 24:are 2501:)); 2459:int 2444:)); 2363:)); 2234:)); 2102:std 1854:)); 1815:msg 1806:)); 1767:msg 1731:int 1559:int 1535:... 1474:std 1465:new 1444:std 1429:... 1399:std 1390:... 1309:... 1285:... 1261:... 1240:If 1196:... 1154:... 1113:and 1045:... 882:... 855:... 806:... 744:std 684:std 576:... 531:... 480:std 459:std 302:... 281:std 260:... 222:... 167:int 155:std 143:std 137:map 131:std 122:int 110:std 104:int 66:... 47:C++ 33:C++ 16:In 2597:: 2551:. 2486:== 2414:!( 2408:== 2393:); 2381:!( 2303:!( 2297:== 2282:); 2252:!( 2216:!( 2210:== 2177:); 2141:!( 2120:() 2037:); 2031:!( 1980:== 1965:if 1920:() 1908:); 1902:!( 1845:42 1824:!( 1797:42 1776:!( 1755:() 1746:{} 1580:}; 1577:); 1504:}; 1477::: 1447::: 1402::: 1349:. 1336:}; 1333:{} 1217:); 1130:{} 1127:() 1087:), 1075:{( 1069:}; 1066:{} 991:); 973:), 961:), 936:); 921:42 836:{} 762:++ 747::: 732:++ 687::: 672:+= 654:!= 630:if 618:== 606:if 498:++ 483::: 474:); 462::: 444:++ 435:!= 411:if 399:== 387:if 308:); 284::: 158::: 146::: 134::: 113::: 43:. 20:, 2504:} 2498:2 2495:% 2489:( 2483:0 2480:( 2477:= 2468:{ 2465:) 2456:( 2447:} 2441:8 2438:, 2435:6 2432:, 2429:4 2426:, 2423:2 2420:, 2417:0 2402:( 2387:, 2375:= 2360:9 2357:, 2354:8 2351:, 2348:7 2345:, 2342:6 2339:, 2336:5 2333:, 2330:4 2327:, 2324:3 2321:, 2318:2 2315:, 2312:1 2309:, 2306:0 2291:( 2279:9 2276:, 2273:8 2270:, 2267:7 2264:, 2258:, 2255:0 2246:= 2231:6 2228:, 2225:5 2222:, 2219:4 2204:( 2195:; 2189:= 2174:6 2171:, 2168:5 2165:, 2162:4 2159:, 2156:3 2153:, 2150:2 2147:, 2144:1 2135:= 2123:{ 2111:; 2105:. 2088:; 2082:= 2073:( 2040:} 2025:~ 2019:. 2013:= 2001:; 1995:= 1986:) 1983:0 1974:. 1968:( 1959:{ 1950:( 1941:} 1938:; 1932:= 1923:{ 1911:} 1896:~ 1890:. 1884:= 1875:{ 1866:( 1857:} 1848:, 1842:, 1836:, 1830:, 1818:, 1812:( 1800:, 1794:, 1788:, 1782:, 1770:, 1764:( 1758:{ 1737:; 1687:} 1681:{ 1672:, 1663:, 1654:, 1651:T 1648:( 1632:} 1626:{ 1617:( 1597:D 1565:= 1550:{ 1501:} 1492:( 1471:( 1462:( 1438:{ 1435:) 1420:( 1378:{ 1324:( 1318:: 1315:) 1300:( 1294:: 1288:{ 1276:: 1235:} 1223:( 1211:( 1205:{ 1202:) 1184:, 1169:( 1148:, 1090:1 1081:( 1060:T 1057:( 1048:T 1033:{ 1020:1 985:) 979:( 967:( 955:( 949:( 930:, 924:, 918:( 912:} 903:( 897:( 891:{ 888:) 873:( 824:( 771:} 768:} 765:; 759:s 756:* 741:} 738:; 735:s 729:} 726:; 714:, 711:s 708:( 699:; 678:; 675:2 669:s 663:{ 660:) 651:) 648:1 645:+ 642:s 639:( 636:* 633:( 627:{ 624:) 615:s 612:* 609:( 603:{ 600:) 597:s 594:* 591:( 585:{ 582:) 570:, 564:T 561:, 558:s 555:* 546:( 525:, 522:T 507:} 504:} 501:; 495:s 492:* 477:} 468:( 450:; 447:s 441:) 432:) 429:1 426:+ 423:s 420:( 417:* 414:( 408:{ 405:) 396:s 393:* 390:( 384:{ 381:) 378:s 375:* 372:( 366:{ 363:) 360:s 357:* 348:( 296:, 275:( 237:; 216:, 193:; 176:; 152:, 128:, 107:, 81:;

Index

computer programming
templates
C++
C++11
D programming language
ellipsis
function overloading
sliced
template alias arguments
AliasSeq
Variadic function
Variadic macro
C preprocessor
"Variadic Templates for C++0x"
Working draft for the C++ language, January 16, 2012
Variadic Templates in D language
Category
Computer programming

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.