You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/Algorithm/MinMaxHeap.pm6
+6-11Lines changed: 6 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,12 @@ use Algorithm::MinMaxHeap::CmpOperator;
7
7
has@.nodes;
8
8
hasMu$.type;
9
9
10
-
multisubmethodBUILD() {
11
-
$!type=Int;
12
-
}
13
-
14
-
multisubmethodBUILD(Mu:U:$!type) {
15
-
if (Algorithm::MinMaxHeap::Comparable|Cool|Str|Rat|Int|Num~~$!type) {
16
-
# nothing to do
17
-
} else {
18
-
die"ERROR: Not compatible type is specified";
19
-
}
20
-
}
10
+
multisubmethodBUILD(Int:U:$!type) { Int===$!typeordie"ERROR: Not compatible type is specified"; } # when no parameters are specified $!type === Int
11
+
multisubmethodBUILD(Algorithm::MinMaxHeap::Comparable:U:$!type) { Algorithm::MinMaxHeap::Comparable ===$!typeordie"ERROR: Not compatible type is specified"; }
12
+
multisubmethodBUILD(Str:U:$!type) { Str===$!typeordie"ERROR: Not compatible type is specified"; }
13
+
multisubmethodBUILD(Rat:U:$!type) { Rat===$!typeordie"ERROR: Not compatible type is specified"; }
14
+
multisubmethodBUILD(Num:U:$!type) { Num===$!typeordie"ERROR: Not compatible type is specified"; }
15
+
multisubmethodBUILD(Cool:U:$!type) { Cool===$!typeordie"ERROR: Not compatible type is specified"; }
0 commit comments