I'm writing a template class in C++ which, among other things, fills arrays passed to member functions. Occasionally the array might be larger than the data structure from which it's being filled. I'd like to fill the excess elements with data that it will be clear did not come the class.
If I leave the element untouched, the garbage in there could be interperted as valid data, as could any "flag" value I can think of. A further complication is that the data could be of any type.
A solution that works in C too would be more useful, as I anticipate encountering this problem again in the future.
If I leave the element untouched, the garbage in there could be interperted as valid data, as could any "flag" value I can think of. A further complication is that the data could be of any type.
A solution that works in C too would be more useful, as I anticipate encountering this problem again in the future.