Convert std::vector<std::string> to chaiscript vector and back?


I fail to convert a std::vector<std::string> to a chaiscript vector and back - what documentation do I not find?

My code looks like this:

std::vector<std:string> vec =  /*...*/
std::string name = "something";
call(name, vec); // function object from chaiscript

When printing the type of vec inside chaiscript:

call(name, vec) {
    // ...

I get


So I am clearly missing some things.

The setup code for the chaiscript instance is here and the usage of the function is here (I’m a newbie to c++ and this code is messy, I know that).

Would appreciate any pointers to documentation …


Letting ChaiScript know about the type is handy:



Hm. I didn’t realize these things are not added by the default bootstrap process. What things would I also like to add? Are there more “core”/“base” things I should add to the engine?

This solved my issue, thank you very much!


I added vector|int, vector|string, and map|bool…

But there are likely more types I’d move between C++ and ChaiScript. Would be good to move this to a dedicated project with some handy map/vector types. Which ones do you think you’d make use of?


Well… all basetypes + basetypes and vector + basetype and map, where “basetypes” includes bool, all integer types and all floating-point types, string, and of course vector and map itself.


The size of the binary and compile time would explode if std::vector<allthethings> were to be added by default. This is why it was decided to have std::vector<Boxed_Value> which can hold any C++ or ChaiScript defined type.

But the utilities do exist for adding them yourself, as you’ve seen.