Skip to content

Commit 406e8f0

Browse files
committed
positioned ^
1 parent acc4453 commit 406e8f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

overviews/collections/arrays.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The `evenElems` method returns a new array that consist of all elements of the a
7474

7575
error: cannot find class manifest for element type T
7676
val arr = new Array[T]((arr.length + 1) / 2)
77-
^
77+
^
7878

7979
What's required here is that you help the compiler out by providing some runtime hint what the actual type parameter of `evenElems` is. This runtime hint takes the form of a class manifest of type `scala.reflect.ClassManifest`. A class manifest is a type descriptor object which describes what the top-level class of a type is. Alternatively to class manifests there are also full manifests of type `scala.reflect.Manifest`, which describe all aspects of a type. But for array creation, only class manifests are needed.
8080

@@ -106,7 +106,7 @@ In both cases, the Scala compiler automatically constructed a class manifest for
106106
scala> def wrap[U](xs: Vector[U]) = evenElems(xs)
107107
<console>:6: error: No ClassManifest available for U.
108108
def wrap[U](xs: Vector[U]) = evenElems(xs)
109-
^
109+
^
110110

111111
What happened here is that the `evenElems` demands a class manifest for the type parameter `U`, but none was found. The solution in this case is, of course, to demand another implicit class manifest for `U`. So the following works:
112112

0 commit comments

Comments
 (0)