Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > make_pair(T1, T...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 45716 of 48020
Post > Topic >>

make_pair(T1, T2) in <utility>

by "subramanian100in@[EMAIL PROTECTED] India" <subramanian100in@[EMAIL PROTECTED] > May 3, 2008 at 03:57 AM

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
 




 4 Posts in Topic:
make_pair(T1, T2) in
"subramanian100in@[E  2008-05-03 03:57:45 
Re: make_pair(T1, T2) in
gnuyuva <gnuyuva@[EMAI  2008-05-03 04:13:09 
Re: make_pair(T1, T2) in
Ian Collins <ian-news@  2008-05-03 23:16:12 
Re: make_pair(T1, T2) in
"kwikius" <a  2008-05-03 12:20:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 8:55:17 CDT 2008.