Skip to content

Library which enables the ability to conditionally call functions at compile time based on the parameters passed, and store those functions in statically typed containers. Written in C++ using template metaprogramming.

Notifications You must be signed in to change notification settings

CameronClay/dynamic-functions

Repository files navigation

Dynamic Functions

Library with class capable of storing any type of function given any return type and parameters and invoke it (using c++ 17 and template meta programming)

Function pointers, functor's and lamdas are stored internally in a std::function and through use of templates and std::variant, these function references are stored in a type-erased manner. This allows one to create a homogenus container of functions that can be invoked with a set of parameters and allows the return value to be captured via a callback.

TypeList Functionality

A typeList represents a list of compile time types which you can perform compile time operations on them such as add, delete, union, interseciton, difference, symmetric difference, length, and more! Typelists are useful in generic programming and have multiple usecases. The most useful case I have found is manipulating types at compile time in order to use them with an std::variant (esentially a structured union, similar to an enum in rust), this allows one to branch differently depending on the type stored in the union and access the specific data corresponding to the stored variant.

This library is equipped with a full suite of TypeList operations.

Unit Testing

  • Unit testing is done using Google Test.

Tooling

  • C++ 20
  • Google Test
  • Visual Studio

About

Library which enables the ability to conditionally call functions at compile time based on the parameters passed, and store those functions in statically typed containers. Written in C++ using template metaprogramming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages