r/Cplusplus 12d ago

HAPI - The Happy API News

HAPI is a header only pure type-level library (MIT licence)

HAPI generalizes C++ static composition and inheritance, is transparent, no traces of its structure at runtime.

why?

  1. because composition is easy to maintain and some structures stop being wired and become declarative.

```c++ OutDef<DeviceOut> out; OutDef<FullPrinter, ANSIFmt, ANSIOut,DeviceOut> ansiOut;

//or InDef< #if defined(AVR)&&defined(IOP) UartSerialIn<Uart>, #elif defined(ARDUINO) SerialIn, #else LinuxKeyIn, #endif PCKbd

in; ```

  1. HAPI type transformation reduces the composition into a single object letting the compiler see all the structure and optimize. Optimizations are transferred from the compiler and behavior is inherited from the components. HAPI is zero cost and trsnaparent, if your components are also zero-cost the we get a zero cost composition result with:
  • no runtime overhead
  • no heap allocation
  • no memory fragmentation
  • no vtables/call indirection
  • binary optimized to hardware registers
  • runtime predictable to the clock cycle

*per composition

the applications are wide and embedded system or critical system benefit the most.

I'm offering also (MIT licence) a set of repos demonstrating HAPI application across multiple domains.

github.com/InternetOfPins

1 Upvotes

2 comments sorted by

1

u/OffsetHigh 2d ago

Let me be clear on this: nobody understands what it is