S
subramanian100in
Given two types T1 and T2, we can create
pair<T1, T2> p(value1, value2);
where value1 and value2 are of types T1 and T2 respectively.
Suppose we want to assign a new pair<> value to p. We can do it as
p = pair<T1, T2>(value3, value4);
where value3 and value4 are of types T1 and T2 respectively.
The last statement can also be written as
p = make_pair(value3, value4);
My doubt is that, when we can do it with pair<T1, T2>(value3, value4)
itself, what is the need for providing make_pair(value3, value4);
That is, make_pair is considered as an alternative to pair<T1,
T2>(T1_val, T2_val).
Why is make_pair provided in the library ? I am unable to understand
the reason.
Kindly clarify.
Thanks
V.Subramanian
pair<T1, T2> p(value1, value2);
where value1 and value2 are of types T1 and T2 respectively.
Suppose we want to assign a new pair<> value to p. We can do it as
p = pair<T1, T2>(value3, value4);
where value3 and value4 are of types T1 and T2 respectively.
The last statement can also be written as
p = make_pair(value3, value4);
My doubt is that, when we can do it with pair<T1, T2>(value3, value4)
itself, what is the need for providing make_pair(value3, value4);
That is, make_pair is considered as an alternative to pair<T1,
T2>(T1_val, T2_val).
Why is make_pair provided in the library ? I am unable to understand
the reason.
Kindly clarify.
Thanks
V.Subramanian