T
tomerdr
Hi,
I have been asked to create a dynamic template array as an exercise.
the array should be used as follows:
CDynamicArray<City*> arr; or CDynamicArray<Street> arr;
It also need to support operator << for streaming the content.
(each class also support operator << )
My question is how do i deal with the fact that the array can contains
pointers ?
I need some way to dereference the item (only if needed),in order to
properly streaming it.
Is overloading operator * for all classes is a good idea?
Is there a solution with a template parameters something like:
(DefaultDereference for use with classes)
template<class T,class Dereferencer=DefaultDereferencer<T> >
class CDynamicArray
{
}
Thanks in advance
I have been asked to create a dynamic template array as an exercise.
the array should be used as follows:
CDynamicArray<City*> arr; or CDynamicArray<Street> arr;
It also need to support operator << for streaming the content.
(each class also support operator << )
My question is how do i deal with the fact that the array can contains
pointers ?
I need some way to dereference the item (only if needed),in order to
properly streaming it.
Is overloading operator * for all classes is a good idea?
Is there a solution with a template parameters something like:
(DefaultDereference for use with classes)
template<class T,class Dereferencer=DefaultDereferencer<T> >
class CDynamicArray
{
}
Thanks in advance