Boost logo

Boost Users :

From: Franz Schnyder (fschnyder_at_[hidden])
Date: 2005-01-23 06:05:00


heroboy schrieb:
> hello everyone,
> &nbsp;&nbsp;&nbsp; what's the difference between "tuple<int> t;"&nbsp; and&nbsp;&nbsp;" tuple<int> t();"

 "tuple<int> t;"
creates an instance of the type tuple<int>.
 "tuple<int> t();"
declares a function t() with return type tuple<int>. If the constructor
takes no argument you must create the instance without the brackets or
the compiler takes it as a function declaration

> why
> tuple<int> t;
> cout<<t;
> is ok.
> But
> tuple<int> t();
> cout<<t;
> make a link error.

the linker can't find the definition of the function "tuple<int> t()"

> I'm using vs.net2003__________________________________________________________________欢迎使用ACMAIL 邮件系统


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net