By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,385 Members | 1,737 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,385 IT Pros & Developers. It's quick & easy.

typeid(arg).name()

P: n/a
Hi, how can I read that program output?

template <typename T>
class OpSum
{
public:
OpSum(T a, T b) { x=a; y=b; }
T getSum() { return x+y; }

private:
T x, y;
};
int main()
{
OpSum<ints(11,12);
OpSum<doubled(11,12);

cout << typeid(s).name() << "\n";
cout << typeid(d).name() << "\n";

return 0;
}
>>>>
5OpSumIiE
5OpSumIdE

May 29 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
josh wrote:
Hi, how can I read that program output?

template <typename T>
class OpSum
{
public:
OpSum(T a, T b) { x=a; y=b; }
T getSum() { return x+y; }

private:
T x, y;
};
int main()
{
OpSum<ints(11,12);
OpSum<doubled(11,12);

cout << typeid(s).name() << "\n";
cout << typeid(d).name() << "\n";

return 0;
}
5OpSumIiE
5OpSumIdE
It looks like you just have. Compilers are free to use whatever they
want for typeid names. Your output looks like gcc, so someone on a gcc
list might be able to help you decode it.

On my system, your code gives

OpSum<int>
OpSum<double>

--
Ian Collins.
May 29 '07 #2

P: n/a
josh wrote :
Hi, how can I read that program output?

template <typename T>
class OpSum
{
public:
OpSum(T a, T b) { x=a; y=b; }
T getSum() { return x+y; }

private:
T x, y;
};
int main()
{
OpSum<ints(11,12);
OpSum<doubled(11,12);

cout << typeid(s).name() << "\n";
cout << typeid(d).name() << "\n";

return 0;
}
>>>>>
5OpSumIiE
5OpSumIdE
By looking at your screen with your eyes? I don't understand your
question. If you want to interpret the type names, read your compiler's
documentation or ask it in a relevant newsgroup. The C++ standard does
not specify what the output of name() should be (which makes your
quetion offtopic here), so it could be anything.

- Sylvester
May 29 '07 #3

P: n/a
On 29 Mag, 12:02, Sylvester Hesp <s.hes...@SPAMoisyn.nlwrote:
josh wrote :
Hi, how can I read that program output?
template <typename T>
class OpSum
{
public:
OpSum(T a, T b) { x=a; y=b; }
T getSum() { return x+y; }
private:
T x, y;
};
int main()
{
OpSum<ints(11,12);
OpSum<doubled(11,12);
cout << typeid(s).name() << "\n";
cout << typeid(d).name() << "\n";
return 0;
}
5OpSumIiE
5OpSumIdE

By looking at your screen with your eyes? I don't understand your
question. If you want to interpret the type names, read your compiler's
documentation or ask it in a relevant newsgroup. The C++ standard does
not specify what the output of name() should be (which makes your
quetion offtopic here), so it could be anything.

- Sylvester
ok I post this msg to a G++ group!

May 29 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.