No ClassTag available compilation error

The compiler keeps producing the following errors:

No ClassTag available for a
  val keys = Array.fill(maxSize+1){ default[a] }
not enough arguments for method fill: (implicit evidence$9: scala.reflect.ClassTag[a])Array[a].
Unspecified value parameter evidence$9.
  val keys = Array.fill(maxSize+1){ default[a] }

for this piece of code

object Utils {
  def default[a] = {
    class DefaultVal {
      var x: a = _
    (new DefaultVal).x

class IndexedHeap[a](maxSize: Int)(implicit ev: Ordering[a]) {
  import ev._
  import Utils._

  val keys = Array.fill(maxSize+1){ default[a] }


Any ideas on how to fix this?


I think adding ClassTag would fix it, like this:


edit based on your comment on the conflict with implicit params and context bounds: Change the implicit parameters to include the ClassTag too

implicit ev: Ordering[a], ct: ClassTag[a]

Need Your Help

Dynamically fill select field in html and javascript

javascript jquery html html5 forms

I am building a form that should advise a user to choose for a certain plan based on the first choice it makes. I've got this code from a youtube tutorial and edited a little bit but it won't work

Why do my images not load in IE but do in xx browser?

c# html css xml

The images for my css header class load correctly in Chrome and FF, but not in IE8 or 7. Anyone know as to what I may be missing?