Hacker News new | past | comments | ask | show | jobs | submit login

Wait ... "imagine" - you can't currently do more than one? That's kind of the essential point with templates.

(I scrolled through it and assumed you'd just do "#define lst list_charp"?)




“Imagine” as in that code is written in an HN comment, not a C source file, and probably hasn’t been checked with a compiler yet. Why don’t you copy and paste it into a test, try it out, and report back?


Yes, as many templates as you like. An A* pathfinder, for instance: https://github.com/glouw/ctl/blob/master/examples/astar.c#L8...

Although if you're interested in just a batch rename, it's something like this:

    #define vec_char str
    #define P
    #define T char
    #include <vec.h>


it seems that it "instantiates" two list types: lst_charp and lst_point and uses both of them. What's the issue?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: