Reference or No Reference: The Problem of Ambiguity
Well, been playing with my Array container and running into some issues with ambiguity on the compiler side. Let's say if I had an array of integers. If I needed to append a new element onto the array, I'd have to pass it a reference or a variable containing the value I want to append. So, that means I can't just pass it a literal, which can't be converted to a reference. However, I can't really overload a method either with only having the parameter differ by whether its a reference or not. Kind of a tricky bind. I may have to go with the non-reference solution, since it solves quite a few problems.
Also started playing with the List container. First thing I learned is that you can't encapsulate a structure within a template class unless its also a template structure. No wonder the book 3DGEA had list nodes be a seperate template class. Makes alot of seense now. The things you learn by trying the things that are wrong.

0 Comments:
Post a Comment
<< Home