Boost logo

Boost :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-02-10 17:25:44

----- Original Message -----
From: "Brian Braatz" <brianb_at_[hidden]>
> [Brian Braatz]
> Hahahahaha
> " Macros were avoided because everyone knows macros are evil, unless we
> are the ones writing them."
> I LOVE THIS LINE. Please keep it in :)

Thanks :)

> On a serious note though, with your lib done the way it is , if someone
> WANTS macros, there is nothing preventing them from having them.
> I for example- MIGHT take your library and stuff __FILE__ __LINE__ into
> the id. For this I would use a macro. This is also why I made the
> request for the char*name type to be a template param. I may want to
> plop in my own struct that has the __FILE__ and __LINE__ in it.

The current implementation uses a map<string, pair<int, double> > for
gathering of stats. This makes it easy to access data by profile name and to
accumulate data for a named profile. Of course this could be rewritten, but
my goal is to do as little work as possible. ;)

What if instead you wrote:


Or better yet:

  map<string, pair<int, string> > my_map;

  #define PROFILE(TKN) mymap[#TKN] = pair<int,string>(__LINE__, __FILE__);
  #define PROFILE(TKN) /* */

Would these be acceptable alternatives?

Christopher Diggins
Object Oriented Template Library (OOTL)

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