Boost logo

Boost :

From: David Greene (greened_at_[hidden])
Date: 2004-12-27 14:44:48

I asked this question a year or two ago on the list.

Has anyone come up with a good way to dump template metaprogramming
information at compile time? I'd like to be able to do this both
in a "print" sense (compiler warnings) and an "error" sence (compiler

I hacked something together last week that sort of does the job.
There's a print<Message, FileLine> class that has a constructor with
an unused variable declared. gcc gives a nice warning with -Wall.
I also have some hacked macros to pass file and line number information
to the printer.

The printer will dump a warning if its constructor is ever instantiated.

The use of all this appears in my last post in the "Named Template
Parameters" thread.

But this is really terrible. I don't like it much so I'm hoping
someone else has a better solution. In particular, it's almost useless
if there are any errors in the code because compilation will stop
before instantiation happens. Unfortunately, this is _exactly_ the
case where one really wants to get this information and figure out
what's causing the compiler abort.

I know this is useful functionality, practically required for any
large metaprogramming project. I'd like to see if Boost can make
something really good.


Boost list run by bdawes at, gregod at, cpdaniel at, john at