score:3

Accepted answer

you already gave the answer yourself: if you want to be able to return a bitset in appropriate cases, you need to get rid of that type parameter in the return type. there is no bitset[int], obviously.

all the information you need is already handled by the appropriate canbuildfrom implicits which have a fallback definition of the type canbuildfrom[coll, a, traversable[a]] (or whatever may be over traversable in the type hierarchy).

of course, the canbuildfrom must be sensible but i think it’s actually possible to abuse it and return a truly strange that. nonetheless, the defaults are pretty sane.


Related Query

More Query from same tag