S
subramanian100in
Consider:
template <typename T,
typename charT = char,
typename traits = char_traits<charT>,
typename Difference = ptrdiff_t>
class istream_iterator;
I pass only the element type like 'int' as in
istream_iterator<int> isi(cin);
In the above construction, the second parameter to the class template
istream_iterator is the default argument 'char' which is taken by
default because I did not supply the second argument.
What other types can we specify as the second argument to the second
parameter ? What is the significance of this second parameter and
where is it useful to provide a programmer-supplied second
argument(kindly provide a code sample for this) ?
Suppose 'Test' is a user-defined class type. Can we write like:
istream_iterator<int, Test> isi(cin);
What is its meaning of passing the second argument which is different
from the default 'char' ?
Kindly explain.
Thanks
V.Subramanian
template <typename T,
typename charT = char,
typename traits = char_traits<charT>,
typename Difference = ptrdiff_t>
class istream_iterator;
I pass only the element type like 'int' as in
istream_iterator<int> isi(cin);
In the above construction, the second parameter to the class template
istream_iterator is the default argument 'char' which is taken by
default because I did not supply the second argument.
What other types can we specify as the second argument to the second
parameter ? What is the significance of this second parameter and
where is it useful to provide a programmer-supplied second
argument(kindly provide a code sample for this) ?
Suppose 'Test' is a user-defined class type. Can we write like:
istream_iterator<int, Test> isi(cin);
What is its meaning of passing the second argument which is different
from the default 'char' ?
Kindly explain.
Thanks
V.Subramanian