C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

printing template arguments

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
morpheusStein@hotmail.com
Guest





PostPosted: Fri Apr 23, 2004 12:19 am    Post subject: printing template arguments Reply with quote



I want to study the mechanism of expression
templates. I find that it's difficult to understand
what the template arguments are.
Is there any way to get information about the
template arguments during instantiation? Any
compiler option in g++ for such a purpose?

Thanks for your help. :-)

Moria

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
David Abrahams
Guest





PostPosted: Fri Apr 23, 2004 11:08 pm    Post subject: Re: printing template arguments Reply with quote



[email]morpheusStein (AT) hotmail (DOT) com[/email] (morpheusStein (AT) hotmail (DOT) com) writes:

Quote:
I want to study the mechanism of expression
templates. I find that it's difficult to understand
what the template arguments are.
Is there any way to get information about the
template arguments during instantiation? Any
compiler option in g++ for such a purpose?

Thanks for your help. :-)

Moria

You could instantiate boost::mpl::print<T> from within your template
(see [url]http://www.boost.org/boost/mpl/print.hpp)[/url]. It's been tuned to
generate warnings that will show you what T is on many compilers. G++
is a good one for looking at template diagnostics, because it doesn't
do overzealous "typedef substitution" like many others do, thereby
obscuring the actual types.

Cheers,
--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Pete Becker
Guest





PostPosted: Sat Apr 24, 2004 11:19 am    Post subject: Re: printing template arguments Reply with quote



"morpheusStein (AT) hotmail (DOT) com" wrote:
Quote:

I want to study the mechanism of expression
templates. I find that it's difficult to understand
what the template arguments are.
Is there any way to get information about the
template arguments during instantiation? Any
compiler option in g++ for such a purpose?


Put an error in your code, and read the error messages. <g> Or implement
the compile-time deubgger that I invented ten years ago: it lets you
step through template instantiations as the compiler evaluates them.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Stephen C. Dewhurst
Guest





PostPosted: Sun Apr 25, 2004 1:42 am    Post subject: Re: printing template arguments Reply with quote

On 24 Apr 2004 07:19:47 -0400, Pete Becker <petebecker (AT) acm (DOT) org> wrote:

Or implement
Quote:
the compile-time deubgger that I invented ten years ago: it lets you
step through template instantiations as the compiler evaluates them.

I don't recall this. Do you have a pointer to it?

Thanks,

Steve

www.semantics.org

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Pete Becker
Guest





PostPosted: Sun Apr 25, 2004 11:04 pm    Post subject: Re: printing template arguments Reply with quote

"Stephen C. Dewhurst" wrote:
Quote:

On 24 Apr 2004 07:19:47 -0400, Pete Becker <petebecker (AT) acm (DOT) org> wrote:

Or implement
the compile-time deubgger that I invented ten years ago: it lets you
step through template instantiations as the compiler evaluates them.

I don't recall this. Do you have a pointer to it?


www.fantasyware.com. <g>

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Stephen C. Dewhurst
Guest





PostPosted: Tue Apr 27, 2004 6:11 pm    Post subject: Re: printing template arguments Reply with quote

On 25 Apr 2004 19:04:30 -0400, Pete Becker <petebecker (AT) acm (DOT) org> wrote:

Quote:
"Stephen C. Dewhurst" wrote:

On 24 Apr 2004 07:19:47 -0400, Pete Becker <petebecker (AT) acm (DOT) org> wrote:

Or implement
the compile-time deubgger that I invented ten years ago: it lets you
step through template instantiations as the compiler evaluates them.

I don't recall this. Do you have a pointer to it?


www.fantasyware.com.

Well, I guess it was too good to be true; guess I'll just keep working
on it...but thanks for the pointer anyway!

Steve

www.semantics.org

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Ben Hutchings
Guest





PostPosted: Wed Apr 28, 2004 9:33 am    Post subject: Re: printing template arguments Reply with quote

Pete Becker wrote:
Quote:
"Stephen C. Dewhurst" wrote:

On 24 Apr 2004 07:19:47 -0400, Pete Becker <petebecker (AT) acm (DOT) org> wrote:

Or implement
the compile-time deubgger that I invented ten years ago: it lets you
step through template instantiations as the compiler evaluates them.

I don't recall this. Do you have a pointer to it?


www.fantasyware.com.

It looks like it would not be too hard to add this to GNU C++ by
instrumenting functions such as instantiate_class_template,
instantiate_template and resolve_overloaded_unification in
gcc/cp/pt.c.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.