Let us suppose, we have to create the OddList[+T] which contains only odd number of elements.
Now can we do something like this
OddList(1,2) //Works fine
OddList(1,2,3) //Compilation error
if there is no condition of odd/even then we would simply do as below
object OddList{
def apply[T](eles: T*) = ...
}
But can we control number of arguments that could be passed?
Thanks @Dylan and everyone who asked to explore to macros way. I don't know if there are better ways, I would love to know but macros way works for me, at least for now. I tried the below code and it worked.