In article <9e01dd24-f5ff-4511-a4b5-fb64ee47f793
@d21g2000prf.googlegroups.com>,
says...
> For a type T, consider vector<T>::value_type. When is this member
> 'value_type' useful; in other words, when is the use of value_type
> unavoidable?
>
> Kindly clarify.
>
> The reason for asking this question is the following:
>
> For a particular type T, say std::string, Suppose I use,
> vector<string>::value_type obj;
> But, to initialize or assign a value to 'obj', we have to know the
> actual type T. So we can simply declare
> string obj;
>
> In this example, the need for value_type is AVOIDABLE.
>
> But there should be some genuine situation wherein the use of
> value_type is UNAVOIDABLE. I am unable to come up with an example for
> this unavoidable situation. Please clarify.
Write a template to sum the elements in a container, and see if you
don't find a use for it.
--
Later,
Jerry.
The universe is a figment of its own imagination.