Skip to content

Show & Tell: format-argument binding wrapper built on top of map-macro #15

Description

@qxov

Hi @swensontec,

I wanted to share a practical use case for your excellent map-macro library.

I’ve created a tiny header-only project called ezprintf (https://github.com/qxov/ezprintf). It provides explicit format-argument binding for standard printf based on your recursive MAP/MAP_LIST implementation.

Instead of separating a massive format string from its arguments, it allows syntax like this:

ezprintf(
    "test ", _i32(10), "\n", 
    _x16("04", 123), ("A = %s\n", "asd")
);

How your library makes this possible:

  1. It automatically normalizes bare string literals into tuples via MAP_LIST.
  2. It then uses MAP to seamlessly isolate and concatenate all format strings into a single C string literal at compile time.
  3. Finally, it unpacks and places the remaining arguments right after the format string.

Just wanted to say a huge thank you for creating map-macro! It’s a fantastic piece of metaprogramming.

Feel free to close this issue whenever you like, as it's purely a "Show and Tell" to let you know how your work is being utilized in the wild.

Best regards,
Andrey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions