You want to use the
type_conversion functionality to make chaiscript aware of a user defined type conversion. You can use
add_type_conversion from within ChaiScript:
chai.add(type_conversion...) shown here:
The signature you almost certainly want is the version that applies type conversions that C++ knows about, basically:
This version will fail to compile if C++ does not find a conversion. In your example above, it should find a conversion and should work.