Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.111.0

overview

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

std.algorithm

This package implements generic algorithms oriented towards the processing ofsequences. Sequences processed by these functions define range-basedinterfaces. See alsoReference on ranges andtutorial on ranges.
Algorithms are categorized into the following submodules:
SubmoduleFunctions
Searchingall any balancedParens boyerMooreFinder canFind commonPrefix count countUntil endsWith find findAdjacent findAmong findSkip findSplit findSplitAfter findSplitBefore minCount maxCount minElement maxElement minIndex maxIndex minPos maxPos skipOver startsWith until 
Comparisonamong castSwitch clamp cmp either equal isPermutation isSameLength levenshteinDistance levenshteinDistanceAndPath max min mismatch predSwitch 
Iterationcache cacheBidirectional chunkBy cumulativeFold each filter filterBidirectional fold group joiner map mean permutations reduce splitWhen splitter substitute sum uniq 
SortingcompleteSort isPartitioned isSorted isStrictlyMonotonic ordered strictlyOrdered makeIndex merge multiSort nextEvenPermutation nextPermutation nthPermutation partialSort partition partition3 schwartzSort sort topN topNCopy topNIndex 
Set operations
(setops)
cartesianProduct largestPartialIntersection largestPartialIntersectionWeighted multiwayMerge multiwayUnion setDifference setIntersection setSymmetricDifference 
MutationbringToFront copy fill initializeAll move moveAll moveSome moveEmplace moveEmplaceAll moveEmplaceSome remove reverse strip stripLeft stripRight swap swapRanges uninitializedFill 
Many functions in this package are parameterized with apredicate.The predicate may be any suitable callable type(a function, a delegate, afunctor, or a lambda), or acompile-time string. The string may consist ofany legal Dexpression that uses the symbola (for unary functions) or thesymbolsa andb (for binary functions). These names will NOTinterfere with other homonym symbols in user code because they areevaluated in a different context. The default for all binarycomparison predicates is"a == b" for unordered operations and"a < b" for ordered operations.

Example

int[] a = ...;staticbool greater(int a,int b){return a > b;}sort!greater(a);// predicate as aliassort!((a, b) => a > b)(a);// predicate as a lambda.sort!"a > b"(a);// predicate as string// (no ambiguity with array name)sort(a);// no predicate, "a < b" is implicit

License:
Boost License 1.0.
Authors:
Andrei Alexandrescu

Sourcestd/algorithm/package.d

Copyright © 1999-2025 by theD Language Foundation | Page generated byDdoc on Fri Oct 10 22:10:23 2025

[8]ページ先頭

©2009-2025 Movatter.jp