I have been reading (ahem and re-reading) "C++ Template Metaprogramming"
I have a problem I am trying to solve and was up late last night looking
for the answer to jump out at me. If nothing else this helps me as I
tend to re-read the same chapters over and over.
Here is what I am trying to do
In working on coded I am adding to the proposed Boost Profiler (started
by Chris Diggings, inherited by yours truly).
I am using RAII all "over" my program in the extensions I am adding to
the profiler. This puts me in a spot where I have MACROs which stuff the
profile points in the program. Now the problem is I would like to be
able to add a template param to the TYPE of the profile points which
gives it the initialization code for the STREAM it is using. The problem
is since the objects themselves get created ALL OVER the program, I
don't have a single point of construction (because I am using RAII to
track the life cycles inside the functions themselves).
I.e. I want to be able to use Boost.IOstreams or ofstream or whatever
for these objects.I just need to , at the TYPE DEFINITION be able to
define how to initialize this passed stream.
I need to be able to do something like this
Template