Please enable JavaScript to view the comments powered by Disqus.

C++ type reflection library. Runtime registration, interrogation, and manipulation of types.

  • C++ 11, no Boost dependency.
  • Cross platform: Linux, OSX, Windows.
  • Liberal MIT licence.
  • Documentation.


Blog latest

Ponder 2.1

12 Oct 2016

The emphasis was on Lua scripting in this release.

Simple Example

class Adder
    Adder() : total_(0)     {}
    void add(int value)     { total_ += value; }
    int getTotal() const    { return total_; }
    int total_;    
A C++ class that we would like to use.
    .function("add",   &Adder::add)
    .property("total", &Adder::getTotal);
How we would like to expose the class using Ponder. We expose a constructor, an "add" function, and a "total" property.
auto const& metaclass = ponder::classByType<Adder>(); // find the class

auto adder = metaclass.construct(); // create an instance

auto const& func = metaclass.function("add");
ponder::runtime::call(func, 7); // call a function
ponder::runtime::call(func, 5);

int total = adder.get("total"); // get a property
Now we can make runtime instances of the object and manipulate them. See documentation for more details.