 |
Changeset 2836
- Timestamp:
- 11/09/07 22:15:32
(1 year ago)
- Author:
- schveiguy
- Message:
updated for const
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2810 |
r2836 |
|
| 79 | 79 | * The index of the first match or buf.length if no match was found. |
|---|
| 80 | 80 | */ |
|---|
| 81 | | size_t find( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 81 | size_t find( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 82 | 82 | |
|---|
| 83 | 83 | |
|---|
| … | … | |
| 98 | 98 | * The index of the first match or buf.length if no match was found. |
|---|
| 99 | 99 | */ |
|---|
| 100 | | size_t find( Elem[] buf, Elem[] pat, Pred2E pred = Pred2E.init ); |
|---|
| | 100 | size_t find( const(Elem)[] buf, const(Elem)[] pat, Pred2E pred = Pred2E.init ); |
|---|
| 101 | 101 | |
|---|
| 102 | 102 | } |
|---|
| … | … | |
| 108 | 108 | |
|---|
| 109 | 109 | |
|---|
| 110 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 110 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 111 | 111 | { |
|---|
| 112 | 112 | foreach( size_t pos, Elem cur; buf ) |
|---|
| … | … | |
| 119 | 119 | |
|---|
| 120 | 120 | |
|---|
| 121 | | size_t fn( Elem[] buf, Elem[] pat, Pred pred = Pred.init ) |
|---|
| | 121 | size_t fn( const(Elem)[] buf, const(Elem)[] pat, Pred pred = Pred.init ) |
|---|
| 122 | 122 | { |
|---|
| 123 | 123 | if( buf.length == 0 || |
|---|
| … | … | |
| 229 | 229 | * The index of the first match or buf.length if no match was found. |
|---|
| 230 | 230 | */ |
|---|
| 231 | | size_t rfind( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 231 | size_t rfind( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 232 | 232 | |
|---|
| 233 | 233 | |
|---|
| … | … | |
| 248 | 248 | * The index of the first match or buf.length if no match was found. |
|---|
| 249 | 249 | */ |
|---|
| 250 | | size_t rfind( Elem[] buf, Elem[] pat, Pred2E pred = Pred2E.init ); |
|---|
| | 250 | size_t rfind( const(Elem)[] buf, const(Elem)[] pat, Pred2E pred = Pred2E.init ); |
|---|
| 251 | 251 | } |
|---|
| 252 | 252 | else |
|---|
| … | … | |
| 257 | 257 | |
|---|
| 258 | 258 | |
|---|
| 259 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 259 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 260 | 260 | { |
|---|
| 261 | 261 | if( buf.length == 0 ) |
|---|
| … | … | |
| 273 | 273 | |
|---|
| 274 | 274 | |
|---|
| 275 | | size_t fn( Elem[] buf, Elem[] pat, Pred pred = Pred.init ) |
|---|
| | 275 | size_t fn( const(Elem)[] buf, const(Elem)[] pat, Pred pred = Pred.init ) |
|---|
| 276 | 276 | { |
|---|
| 277 | 277 | if( buf.length == 0 || |
|---|
| … | … | |
| 388 | 388 | * The index of the first match or buf.length if no match was found. |
|---|
| 389 | 389 | */ |
|---|
| 390 | | size_t kfind( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 390 | size_t kfind( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 391 | 391 | |
|---|
| 392 | 392 | |
|---|
| … | … | |
| 412 | 412 | * The index of the first match or buf.length if no match was found. |
|---|
| 413 | 413 | */ |
|---|
| 414 | | size_t kfind( Elem[] buf, Elem[] pat, Pred2E pred = Pred2E.init ); |
|---|
| | 414 | size_t kfind( const(Elem)[] buf, const(Elem)[] pat, Pred2E pred = Pred2E.init ); |
|---|
| 415 | 415 | } |
|---|
| 416 | 416 | else |
|---|
| … | … | |
| 421 | 421 | |
|---|
| 422 | 422 | |
|---|
| 423 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 423 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 424 | 424 | { |
|---|
| 425 | 425 | foreach( size_t pos, Elem cur; buf ) |
|---|
| … | … | |
| 432 | 432 | |
|---|
| 433 | 433 | |
|---|
| 434 | | size_t fn( Elem[] buf, Elem[] pat, Pred pred = Pred.init ) |
|---|
| | 434 | size_t fn( const(Elem)[] buf, const(Elem)[] pat, Pred pred = Pred.init ) |
|---|
| 435 | 435 | { |
|---|
| 436 | 436 | if( buf.length == 0 || |
|---|
| … | … | |
| 570 | 570 | * The index of the first match or buf.length if no match was found. |
|---|
| 571 | 571 | */ |
|---|
| 572 | | size_t krfind( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 572 | size_t krfind( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 573 | 573 | |
|---|
| 574 | 574 | |
|---|
| … | … | |
| 594 | 594 | * The index of the first match or buf.length if no match was found. |
|---|
| 595 | 595 | */ |
|---|
| 596 | | size_t krfind( Elem[] buf, Elem[] pat, Pred2E pred = Pred2E.init ); |
|---|
| | 596 | size_t krfind( const(Elem)[] buf, const(Elem)[] pat, Pred2E pred = Pred2E.init ); |
|---|
| 597 | 597 | } |
|---|
| 598 | 598 | else |
|---|
| … | … | |
| 603 | 603 | |
|---|
| 604 | 604 | |
|---|
| 605 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 605 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 606 | 606 | { |
|---|
| 607 | 607 | if( buf.length == 0 ) |
|---|
| … | … | |
| 619 | 619 | |
|---|
| 620 | 620 | |
|---|
| 621 | | size_t fn( Elem[] buf, Elem[] pat, Pred pred = Pred.init ) |
|---|
| | 621 | size_t fn( const(Elem)[] buf, const(Elem)[] pat, Pred pred = Pred.init ) |
|---|
| 622 | 622 | { |
|---|
| 623 | 623 | if( buf.length == 0 || |
|---|
| … | … | |
| 752 | 752 | * The index of the first match or buf.length if no match was found. |
|---|
| 753 | 753 | */ |
|---|
| 754 | | size_t findIf( Elem[] buf, Pred1E pred ); |
|---|
| | 754 | size_t findIf( const(Elem)[] buf, Pred1E pred ); |
|---|
| 755 | 755 | } |
|---|
| 756 | 756 | else |
|---|
| … | … | |
| 761 | 761 | |
|---|
| 762 | 762 | |
|---|
| 763 | | size_t fn( Elem[] buf, Pred pred ) |
|---|
| | 763 | size_t fn( const(Elem)[] buf, Pred pred ) |
|---|
| 764 | 764 | { |
|---|
| 765 | 765 | foreach( size_t pos, Elem cur; buf ) |
|---|
| … | … | |
| 817 | 817 | * The index of the first match or buf.length if no match was found. |
|---|
| 818 | 818 | */ |
|---|
| 819 | | size_t rfindIf( Elem[] buf, Pred1E pred ); |
|---|
| | 819 | size_t rfindIf( const(Elem)[] buf, Pred1E pred ); |
|---|
| 820 | 820 | } |
|---|
| 821 | 821 | else |
|---|
| … | … | |
| 826 | 826 | |
|---|
| 827 | 827 | |
|---|
| 828 | | size_t fn( Elem[] buf, Pred pred ) |
|---|
| | 828 | size_t fn( const(Elem)[] buf, Pred pred ) |
|---|
| 829 | 829 | { |
|---|
| 830 | 830 | if( buf.length == 0 ) |
|---|
| … | … | |
| 889 | 889 | * The index of the first match or buf.length if no match was found. |
|---|
| 890 | 890 | */ |
|---|
| 891 | | size_t findAdj( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 891 | size_t findAdj( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 892 | 892 | |
|---|
| 893 | 893 | } |
|---|
| … | … | |
| 899 | 899 | |
|---|
| 900 | 900 | |
|---|
| 901 | | size_t fn( Elem[] buf, Pred pred = Pred.init ) |
|---|
| | 901 | size_t fn( const(Elem)[] buf, Pred pred = Pred.init ) |
|---|
| 902 | 902 | { |
|---|
| 903 | 903 | if( buf.length < 2 ) |
|---|
| … | … | |
| 970 | 970 | * True if an element equivalent to pat is found, false if not. |
|---|
| 971 | 971 | */ |
|---|
| 972 | | size_t contains( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 972 | size_t contains( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 973 | 973 | |
|---|
| 974 | 974 | |
|---|
| … | … | |
| 988 | 988 | * True if an element equivalent to pat is found, false if not. |
|---|
| 989 | 989 | */ |
|---|
| 990 | | size_t contains( Elem[] buf, Elem[] pat, Pred2E pred = Pred2E.init ); |
|---|
| | 990 | size_t contains( const(Elem)[] buf, const(Elem)[] pat, Pred2E pred = Pred2E.init ); |
|---|
| 991 | 991 | } |
|---|
| 992 | 992 | else |
|---|
| … | … | |
| 1072 | 1072 | * and bufB match, where N = min$(LP)bufA.length, bufB.length$(RP). |
|---|
| 1073 | 1073 | */ |
|---|
| 1074 | | size_t mismatch( Elem[] bufA, Elem[] bufB, Pred2E pred = Pred2E.init ); |
|---|
| | 1074 | size_t mismatch( const(Elem)[] bufA, const(Elem)[] bufB, Pred2E pred = Pred2E.init ); |
|---|
| 1075 | 1075 | |
|---|
| 1076 | 1076 | } |
|---|
| … | … | |
| 1082 | 1082 | |
|---|
| 1083 | 1083 | |
|---|
| 1084 | | size_t fn( Elem[] bufA, Elem[] bufB, Pred pred = Pred.init ) |
|---|
| | 1084 | size_t fn( const(Elem)[] bufA, const(Elem)[] bufB, Pred pred = Pred.init ) |
|---|
| 1085 | 1085 | { |
|---|
| 1086 | 1086 | size_t posA = 0, |
|---|
| … | … | |
| 1160 | 1160 | * The number of elements matching pat. |
|---|
| 1161 | 1161 | */ |
|---|
| 1162 | | size_t count( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 1162 | size_t count( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 1163 | 1163 | |
|---|
| 1164 | 1164 | } |
|---|
| … | … | |
| 1170 | 1170 | |
|---|
| 1171 | 1171 | |
|---|
| 1172 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 1172 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 1173 | 1173 | { |
|---|
| 1174 | 1174 | size_t cnt = 0; |
|---|
| … | … | |
| 1236 | 1236 | * The number of elements where pred returns true. |
|---|
| 1237 | 1237 | */ |
|---|
| 1238 | | size_t countIf( Elem[] buf, Pred1E pred = Pred1E.init ); |
|---|
| | 1238 | size_t countIf( const(Elem)[] buf, Pred1E pred = Pred1E.init ); |
|---|
| 1239 | 1239 | |
|---|
| 1240 | 1240 | } |
|---|
| … | … | |
| 1246 | 1246 | |
|---|
| 1247 | 1247 | |
|---|
| 1248 | | size_t fn( Elem[] buf, Pred pred ) |
|---|
| | 1248 | size_t fn( const(Elem)[] buf, Pred pred ) |
|---|
| 1249 | 1249 | { |
|---|
| 1250 | 1250 | size_t cnt = 0; |
|---|
| … | … | |
| 1306 | 1306 | * The number of elements replaced. |
|---|
| 1307 | 1307 | */ |
|---|
| 1308 | | size_t replace( Elem[] buf, Elem pat, Elem val, Pred2E pred = Pred2E.init ); |
|---|
| | 1308 | size_t replace( const(Elem)[] buf, Elem pat, Elem val, Pred2E pred = Pred2E.init ); |
|---|
| 1309 | 1309 | |
|---|
| 1310 | 1310 | } |
|---|
| … | … | |
| 1316 | 1316 | |
|---|
| 1317 | 1317 | |
|---|
| 1318 | | size_t fn( Elem[] buf, Elem pat, Elem val, Pred pred = Pred.init ) |
|---|
| | 1318 | size_t fn( const(Elem)[] buf, Elem pat, Elem val, Pred pred = Pred.init ) |
|---|
| 1319 | 1319 | { |
|---|
| 1320 | 1320 | size_t cnt = 0; |
|---|
| 1321 | 1321 | |
|---|
| 1322 | | foreach( size_t pos, inout Elem cur; buf ) |
|---|
| | 1322 | foreach( size_t pos, ref Elem cur; buf ) |
|---|
| 1323 | 1323 | { |
|---|
| 1324 | 1324 | if( pred( cur, pat ) ) |
|---|
| … | … | |
| 1386 | 1386 | * The number of elements replaced. |
|---|
| 1387 | 1387 | */ |
|---|
| 1388 | | size_t replaceIf( Elem[] buf, Elem val, Pred2E pred = Pred2E.init ); |
|---|
| | 1388 | size_t replaceIf( const(Elem)[] buf, Elem val, Pred2E pred = Pred2E.init ); |
|---|
| 1389 | 1389 | |
|---|
| 1390 | 1390 | } |
|---|
| … | … | |
| 1396 | 1396 | |
|---|
| 1397 | 1397 | |
|---|
| 1398 | | size_t fn( Elem[] buf, Elem val, Pred pred ) |
|---|
| | 1398 | size_t fn( const(Elem)[] buf, Elem val, Pred pred ) |
|---|
| 1399 | 1399 | { |
|---|
| 1400 | 1400 | size_t cnt = 0; |
|---|
| 1401 | 1401 | |
|---|
| 1402 | | foreach( size_t pos, inout Elem cur; buf ) |
|---|
| | 1402 | foreach( size_t pos, ref Elem cur; buf ) |
|---|
| 1403 | 1403 | { |
|---|
| 1404 | 1404 | if( pred( cur ) ) |
|---|
| … | … | |
| 1450 | 1450 | * |
|---|
| 1451 | 1451 | * Params: |
|---|
| 1452 | | * buf = The array to scan. This parameter is not marked 'inout' |
|---|
| | 1452 | * buf = The array to scan. This parameter is not marked 'ref' |
|---|
| 1453 | 1453 | * to allow temporary slices to be modified. As buf is not resized |
|---|
| 1454 | | * in any way, omitting the 'inout' qualifier has no effect on the |
|---|
| | 1454 | * in any way, omitting the 'ref' qualifier has no effect on the |
|---|
| 1455 | 1455 | * result of this operation, even though it may be viewed as a |
|---|
| 1456 | 1456 | * side-effect. |
|---|
| … | … | |
| 1463 | 1463 | * The number of elements that do not match pat. |
|---|
| 1464 | 1464 | */ |
|---|
| 1465 | | size_t remove( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 1465 | size_t remove( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 1466 | 1466 | } |
|---|
| 1467 | 1467 | else |
|---|
| … | … | |
| 1551 | 1551 | * |
|---|
| 1552 | 1552 | * Params: |
|---|
| 1553 | | * buf = The array to scan. This parameter is not marked 'inout' |
|---|
| | 1553 | * buf = The array to scan. This parameter is not marked 'ref' |
|---|
| 1554 | 1554 | * to allow temporary slices to be modified. As buf is not resized |
|---|
| 1555 | | * in any way, omitting the 'inout' qualifier has no effect on the |
|---|
| | 1555 | * in any way, omitting the 'ref' qualifier has no effect on the |
|---|
| 1556 | 1556 | * result of this operation, even though it may be viewed as a |
|---|
| 1557 | 1557 | * side-effect. |
|---|
| … | … | |
| 1563 | 1563 | * The number of elements that do not satisfy pred. |
|---|
| 1564 | 1564 | */ |
|---|
| 1565 | | size_t removeIf( Elem[] buf, Pred1E pred ); |
|---|
| | 1565 | size_t removeIf( const(Elem)[] buf, Pred1E pred ); |
|---|
| 1566 | 1566 | } |
|---|
| 1567 | 1567 | else |
|---|
| … | … | |
| 1644 | 1644 | * |
|---|
| 1645 | 1645 | * Params: |
|---|
| 1646 | | * buf = The array to scan. This parameter is not marked 'inout' |
|---|
| | 1646 | * buf = The array to scan. This parameter is not marked 'ref' |
|---|
| 1647 | 1647 | * to allow temporary slices to be modified. As buf is not resized |
|---|
| 1648 | | * in any way, omitting the 'inout' qualifier has no effect on the |
|---|
| | 1648 | * in any way, omitting the 'ref' qualifier has no effect on the |
|---|
| 1649 | 1649 | * result of this operation, even though it may be viewed as a |
|---|
| 1650 | 1650 | * side-effect. |
|---|
| … | … | |
| 1656 | 1656 | * The number of unique elements in buf. |
|---|
| 1657 | 1657 | */ |
|---|
| 1658 | | size_t unique( Elem[] buf, Pred2E pred = Pred2E.init ); |
|---|
| | 1658 | size_t unique( const(Elem)[] buf, Pred2E pred = Pred2E.init ); |
|---|
| 1659 | 1659 | } |
|---|
| 1660 | 1660 | else |
|---|
| … | … | |
| 1719 | 1719 | unittest |
|---|
| 1720 | 1720 | { |
|---|
| 1721 | | void test( char[] buf, char[] pat ) |
|---|
| | 1721 | void test( char[] buf, Cutf8 pat ) |
|---|
| 1722 | 1722 | { |
|---|
| 1723 | 1723 | assert( unique( buf ) == pat.length ); |
|---|
| … | … | |
| 1751 | 1751 | * |
|---|
| 1752 | 1752 | * Params: |
|---|
| 1753 | | * buf = The array to partition. This parameter is not marked 'inout' |
|---|
| | 1753 | * buf = The array to partition. This parameter is not marked 'ref' |
|---|
| 1754 | 1754 | * to allow temporary slices to be sorted. As buf is not resized |
|---|
| 1755 | | * in any way, omitting the 'inout' qualifier has no effect on |
|---|
| | 1755 | * in any way, omitting the 'ref' qualifier has no effect on |
|---|
| 1756 | 1756 | * the result of this operation, even though it may be viewed |
|---|
| 1757 | 1757 | * as a side-effect. |
|---|
| … | … | |
| 1763 | 1763 | * The number of elements that satisfy pred. |
|---|
| 1764 | 1764 | */ |
|---|
| 1765 | | size_t partition( Elem[] buf, Pred1E pred ); |
|---|
| | 1765 | size_t partition( const(Elem)[] buf, Pred1E pred ); |
|---|
| 1766 | 1766 | } |
|---|
| 1767 | 1767 | else |
|---|
| … | … | |
| 1854 | 1854 | * |
|---|
| 1855 | 1855 | * Params: |
|---|
| 1856 | | * buf = The array to partition. This parameter is not marked 'inout' |
|---|
| | 1856 | * buf = The array to partition. This parameter is not marked 'ref' |
|---|
| 1857 | 1857 | * to allow temporary slices to be sorted. As buf is not resized |
|---|
| 1858 | | * in any way, omitting the 'inout' qualifier has no effect on |
|---|
| | 1858 | * in any way, omitting the 'ref' qualifier has no effect on |
|---|
| 1859 | 1859 | * the result of this operation, even though it may be viewed |
|---|
| 1860 | 1860 | * as a side-effect. |
|---|
| … | … | |
| 1874 | 1874 | * buf.length. |
|---|
| 1875 | 1875 | */ |
|---|
| 1876 | | size_t select( Elem[] buf, Num num, Pred2E pred = Pred2E.init ); |
|---|
| | 1876 | size_t select( const(Elem)[] buf, Num num, Pred2E pred = Pred2E.init ); |
|---|
| 1877 | 1877 | } |
|---|
| 1878 | 1878 | else |
|---|
| … | … | |
| 1979 | 1979 | * |
|---|
| 1980 | 1980 | * Params: |
|---|
| 1981 | | * buf = The array to sort. This parameter is not marked 'inout' to |
|---|
| | 1981 | * buf = The array to sort. This parameter is not marked 'ref' to |
|---|
| 1982 | 1982 | * allow temporary slices to be sorted. As buf is not resized |
|---|
| 1983 | | * in any way, omitting the 'inout' qualifier has no effect on |
|---|
| | 1983 | * in any way, omitting the 'ref' qualifier has no effect on |
|---|
| 1984 | 1984 | * the result of this operation, even though it may be viewed |
|---|
| 1985 | 1985 | * as a side-effect. |
|---|
| … | … | |
| 1988 | 1988 | * callable type. |
|---|
| 1989 | 1989 | */ |
|---|
| 1990 | | void sort( Elem[] buf, Pred2E pred = Pred2E.init ); |
|---|
| | 1990 | void sort( const(Elem)[] buf, Pred2E pred = Pred2E.init ); |
|---|
| 1991 | 1991 | } |
|---|
| 1992 | 1992 | else |
|---|
| … | … | |
| 2150 | 2150 | * The index of the first match or buf.length if no match was found. |
|---|
| 2151 | 2151 | */ |
|---|
| 2152 | | size_t lbound( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 2152 | size_t lbound( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 2153 | 2153 | } |
|---|
| 2154 | 2154 | else |
|---|
| … | … | |
| 2159 | 2159 | |
|---|
| 2160 | 2160 | |
|---|
| 2161 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 2161 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 2162 | 2162 | { |
|---|
| 2163 | 2163 | size_t beg = 0, |
|---|
| … | … | |
| 2234 | 2234 | * The index of the first match or buf.length if no match was found. |
|---|
| 2235 | 2235 | */ |
|---|
| 2236 | | size_t ubound( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 2236 | size_t ubound( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 2237 | 2237 | } |
|---|
| 2238 | 2238 | else |
|---|
| … | … | |
| 2243 | 2243 | |
|---|
| 2244 | 2244 | |
|---|
| 2245 | | size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 2245 | size_t fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 2246 | 2246 | { |
|---|
| 2247 | 2247 | size_t beg = 0, |
|---|
| … | … | |
| 2315 | 2315 | * True if an element equivalent to pat is found, false if not. |
|---|
| 2316 | 2316 | */ |
|---|
| 2317 | | bool bsearch( Elem[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| | 2317 | bool bsearch( const(Elem)[] buf, Elem pat, Pred2E pred = Pred2E.init ); |
|---|
| 2318 | 2318 | } |
|---|
| 2319 | 2319 | else |
|---|
| … | … | |
| 2324 | 2324 | |
|---|
| 2325 | 2325 | |
|---|
| 2326 | | bool fn( Elem[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| | 2326 | bool fn( const(Elem)[] buf, Elem pat, Pred pred = Pred.init ) |
|---|
| 2327 | 2327 | { |
|---|
| 2328 | 2328 | size_t pos = lbound( buf, pat, pred ); |
|---|
| … | … | |
| 2392 | 2392 | * true if setA includes all elements in setB, false if not. |
|---|
| 2393 | 2393 | */ |
|---|
| 2394 | | bool includes( Elem[] setA, Elem[] setB, Pred2E pred = Pred2E.init ); |
|---|
| | 2394 | bool includes( const(Elem)[] setA, const(Elem)[] setB, Pred2E pred = Pred2E.init ); |
|---|
| 2395 | 2395 | } |
|---|
| 2396 | 2396 | else |
|---|
| … | … | |
| 2401 | 2401 | |
|---|
| 2402 | 2402 | |
|---|
| 2403 | | bool fn( Elem[] setA, Elem[] setB, Pred pred = Pred.init ) |
|---|
| | 2403 | bool fn( const(Elem)[] setA, const(Elem)[] setB, Pred pred = Pred.init ) |
|---|
| 2404 | 2404 | { |
|---|
| 2405 | 2405 | size_t posA = 0, |
|---|
| … | … | |
| 2481 | 2481 | * A new array containing the union of setA and setB. |
|---|
| 2482 | 2482 | */ |
|---|
| 2483 | | Elem[] unionOf( Elem[] setA, Elem[] setB, Pred2E pred = Pred2E.init ); |
|---|
| | 2483 | const(Elem)[] unionOf( const(Elem)[] setA, const(Elem)[] setB, Pred2E pred = Pred2E.init ); |
|---|
| 2484 | 2484 | } |
|---|
| 2485 | 2485 | else |
|---|
| … | … | |
| 2490 | 2490 | |
|---|
| 2491 | 2491 | |
|---|
| 2492 | | Elem[] fn( Elem[] setA, Elem[] setB, Pred pred = Pred.init ) |
|---|
| | 2492 | Elem[] fn( const(Elem)[] setA, const(Elem)[] setB, Pred pred = Pred.init ) |
|---|
| 2493 | 2493 | { |
|---|
| 2494 | 2494 | size_t posA = 0, |
|---|
| … | … | |
| 2567 | 2567 | * A new array containing the intersection of setA and setB. |
|---|
| 2568 | 2568 | */ |
|---|
| 2569 | | Elem[] intersectionOf( Elem[] setA, Elem[] setB, Pred2E pred = Pred2E.init ); |
|---|
| | 2569 | const(Elem)[] intersectionOf( const(Elem)[] setA, const(Elem)[] setB, Pred2E pred = Pred2E.init ); |
|---|
| 2570 | 2570 | } |
|---|
| 2571 | 2571 | else |
|---|
| … | … | |
| 2576 | 2576 | |
|---|
| 2577 | 2577 | |
|---|
| 2578 | | Elem[] fn( Elem[] setA, Elem[] setB, Pred pred = Pred.init ) |
|---|
| | 2578 | Elem[] fn( const(Elem)[] setA, const(Elem)[] setB, Pred pred = Pred.init ) |
|---|
| 2579 | 2579 | { |
|---|
| 2580 | 2580 | size_t posA = 0, |
|---|
| … | … | |
| 2649 | 2649 | * A new array containing the elements in setA that are not in setB. |
|---|
| 2650 | 2650 | */ |
|---|
| 2651 | | Elem[] missingFrom( Elem[] setA, Elem[] setB, Pred2E pred = Pred2E.init ); |
|---|
| | 2651 | const(Elem)[] missingFrom( const(Elem)[] setA, const(Elem)[] setB, Pred2E pred = Pred2E.init ); |
|---|
| 2652 | 2652 | } |
|---|
| 2653 | 2653 | else |
|---|
| … | … | |
| 2658 | 2658 | |
|---|
| 2659 | 2659 | |
|---|
| 2660 | | Elem[] fn( Elem[] setA, Elem[] setB, Pred pred = Pred.init ) |
|---|
| | 2660 | Elem[] fn( const(Elem)[] setA, const(Elem)[] setB, Pred pred = Pred.init ) |
|---|
| 2661 | 2661 | { |
|---|
| 2662 | 2662 | size_t posA = 0, |
|---|
| … | … | |
| 2736 | 2736 | * and the elements in setB that are not in setA. |
|---|
| 2737 | 2737 | */ |
|---|
| 2738 | | Elem[] differenceOf( Elem[] setA, Elem[] setB, Pred2E pred = Pred2E.init ); |
|---|
| | 2738 | const(Elem)[] differenceOf( const(Elem)[] setA, const(Elem)[] setB, Pred2E pred = Pred2E.init ); |
|---|
| 2739 | 2739 | } |
|---|
| 2740 | 2740 | else |
|---|
| … | … | |
| 2745 | 2745 | |
|---|
| 2746 | 2746 | |
|---|
| 2747 | | Elem[] fn( Elem[] setA, Elem[] setB, Pred pred = Pred.init ) |
|---|
| | 2747 | Elem[] fn( const(Elem)[] setA, const(Elem)[] setB, Pred pred = Pred.init ) |
|---|
| 2748 | 2748 | { |
|---|
| 2749 | 2749 | size_t posA = 0, |
|---|
| … | … | |
| 2813 | 2813 | * |
|---|
| 2814 | 2814 | * Params: |
|---|
| 2815 | | * buf = The array to convert. This parameter is not marked 'inout' to |
|---|
| | 2815 | * buf = The array to convert. This parameter is not marked 'ref' to |
|---|
| 2816 | 2816 | * allow temporary slices to be sorted. As buf is not resized in |
|---|
| 2817 | | * any way, omitting the 'inout' qualifier has no effect on the |
|---|
| | 2817 | * any way, omitting the 'ref' qualifier has no effect on the |
|---|
| 2818 | 2818 | * result of this operation, even though it may be viewed as a |
|---|
| 2819 | 2819 | * side-effect. |
|---|
| … | … | |
| 2822 | 2822 | * callable type. |
|---|
| 2823 | 2823 | */ |
|---|
| 2824 | | void makeHeap( Elem[] buf, Pred2E pred = Pred2E.init ); |
|---|
| | 2824 | void makeHeap( const(Elem)[] buf, Pred2E pred = Pred2E.init ); |
|---|
| 2825 | 2825 | } |
|---|
| 2826 | 2826 | else |
|---|
| … | … | |
| 2944 | 2944 | * |
|---|
| 2945 | 2945 | * Params: |
|---|
| 2946 | | * buf = The heap to modify. This parameter is marked 'inout' because |
|---|
| | 2946 | * buf = The heap to modify. This parameter is marked 'ref' because |
|---|
| 2947 | 2947 | * buf.length will be altered. |
|---|
| 2948 | 2948 | * val = The element to push onto buf. |
|---|
| … | … | |
| 2951 | 2951 | * callable type. |
|---|
| 2952 | 2952 | */ |
|---|
| 2953 | | void pushHeap( inout Elem[] buf, Elem val, Pred2E pred = Pred2E.init ); |
|---|
| | 2953 | void pushHeap( ref const(Elem)[] buf, Elem val, Pred2E pred = Pred2E.init ); |
|---|
| 2954 | 2954 | } |
|---|
| 2955 | 2955 | else |
|---|
| … | … | |
| 2960 | 2960 | |
|---|
| 2961 | 2961 | |
|---|
| 2962 | | void fn( inout Elem[] buf, Elem val, Pred pred = Pred.init ) |
|---|
| | 2962 | void fn( ref Elem[] buf, Elem val, Pred pred = Pred.init ) |
|---|
| 2963 | 2963 | { |
|---|
| 2964 | 2964 | // NOTE: Indexes are passed instead of references because DMD does |
|---|
| … | … | |
| 2995 | 2995 | template pushHeap( Buf, Val ) |
|---|
| 2996 | 2996 | { |
|---|
| 2997 | | void pushHeap( inout Buf buf, Val val ) |
|---|
| | 2997 | void pushHeap( ref Buf buf, Val val ) |
|---|
| 2998 | 2998 | { |
|---|
| 2999 | 2999 | return pushHeap_!(ElemTypeOf!(Buf)).fn( buf, val ); |
|---|
| … | … | |
| 3004 | 3004 | template pushHeap( Buf, Val, Pred ) |
|---|
| 3005 | 3005 | { |
|---|
| 3006 | | void pushHeap( inout Buf buf, Val val, Pred pred ) |
|---|
| | 3006 | void pushHeap( ref Buf buf, Val val, Pred pred ) |
|---|
| 3007 | 3007 | { |
|---|
| 3008 | 3008 | return pushHeap_!(ElemTypeOf!(Buf), Pred).fn( buf, val, pred ); |
|---|
| … | … | |
| 3066 | 3066 | * |
|---|
| 3067 | 3067 | * Params: |
|---|
| 3068 | | * buf = The heap to modify. This parameter is marked 'inout' because |
|---|
| | 3068 | * buf = The heap to modify. This parameter is marked 'ref' because |
|---|
| 3069 | 3069 | * buf.length will be altered. |
|---|
| 3070 | 3070 | * pred = The evaluation predicate, which should return true if e1 is |
|---|
| … | … | |
| 3072 | 3072 | * callable type. |
|---|
| 3073 | 3073 | */ |
|---|
| 3074 | | void popHeap( inout Elem[] buf, Pred2E pred = Pred2E.init ); |
|---|
| | 3074 | void popHeap( ref const(Elem)[] buf, Pred2E pred = Pred2E.init ); |
|---|
| 3075 | 3075 | } |
|---|
| 3076 | 3076 | else |
|---|
| … | … | |
| 3081 | 3081 | |
|---|
| 3082 | 3082 | |
|---|
| 3083 | | void fn( inout Elem[] buf, Pred pred = Pred.init ) |
|---|
| | 3083 | void fn( ref Elem[] buf, Pred pred = Pred.init ) |
|---|
| 3084 | 3084 | { |
|---|
| 3085 | 3085 | // NOTE: Indexes are passed instead of references because DMD does |
|---|
| … | … | |
| 3124 | 3124 | template popHeap( Buf ) |
|---|
| 3125 | 3125 | { |
|---|
| 3126 | | void popHeap( inout Buf buf ) |
|---|
| | 3126 | void popHeap( ref Buf buf ) |
|---|
| 3127 | 3127 | { |
|---|
| 3128 | 3128 | return popHeap_!(ElemTypeOf!(Buf)).fn( buf ); |
|---|
| … | … | |
| 3133 | 3133 | template popHeap( Buf, Pred ) |
|---|
| 3134 | 3134 | { |
|---|
| 3135 | | void popHeap( inout Buf buf, Pred pred ) |
|---|
| | 3135 | void popHeap( ref Buf buf, Pred pred ) |
|---|
| 3136 | 3136 | { |
|---|
| 3137 | 3137 | return popHeap_!(ElemTypeOf!(Buf), Pred).fn( buf, pred ); |
|---|
| … | … | |
| 3188 | 3188 | * |
|---|
| 3189 | 3189 | * Params: |
|---|
| 3190 | | * buf = The heap to sort. This parameter is not marked 'inout' to |
|---|
| | 3190 | * buf = The heap to sort. This parameter is not marked 'ref' to |
|---|
| 3191 | 3191 | * allow temporary slices to be sorted. As buf is not resized |
|---|
| 3192 | | * in any way, omitting the 'inout' qualifier has no effect on |
|---|
| | 3192 | * in any way, omitting the 'ref' qualifier has no effect on |
|---|
| 3193 | 3193 | * the result of this operation, even though it may be viewed |
|---|
| 3194 | 3194 | * as a side-effect. |
|---|
| … | … | |
| 3197 | 3197 | * callable type. |
|---|
| 3198 | 3198 | */ |
|---|
| 3199 | | void sortHeap( Elem[] buf, Pred2E pred = Pred2E.init ); |
|---|
| | 3199 | void sortHeap( const(Elem)[] buf, Pred2E pred = Pred2E.init ); |
|---|
| 3200 | 3200 | } |
|---|
| 3201 | 3201 | else |
|---|
Download in other formats:
|
 |