Re: [PATCH 1/3] implement generic key/value map
- From
Jeff King <peff@peff.net>
- Date
- Jul 14, 2011, 18:55 UTC
- Message-ID
- <20110714185539.GA27141@sigill.intra.peff.net>
- In-Reply-To
- <CAKPyHN3G41iMGmGgp6jTcWN=Rxt=RTUS7ktgVDhZEXPBRXvTDQ@mail.gmail.com>
On Thu, Jul 14, 2011 at 08:54:07PM +0200, Bert Wesarg wrote:
Show 8 quoted lines
> On Thu, Jul 14, 2011 at 20:52, Bert Wesarg <bert.wesarg@googlemail.com> wrote: > > On Thu, Jul 14, 2011 at 19:51, Jeff King <peff@peff.net> wrote: > >> +#define MAP_IMPLEMENT(name, ktype, vtype, cmp_fun, hash_fun) \ > > > > This define should probably in the header too. Else this is completely useless. > > Ahh. One have to read patch 2/3, to see how to use this. Please feel > free to ignore this than.
Yeah, you could treat this like a C++ template and assume random bits of code will instantiate a map of whatever types they need. But this is C, and we only want to instantiate once. So I just figured to keep the static list of whatever maps git needs in the map.[ch] files.
-Peff