Range based for loops and user types


#1

Hello,

I’m trying to implement range based for loops for a custom C++ class. In C++, the range based for loop works, I got the user_type, constructors and some unrelated member functions added in my chaiscript environment. I can access the user type, call the member functions, but as soon as I try to use the chai range based for I get an exception:

File: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\xstring
Line: 1219

Expression: cannot dereference string iterator because the iterator was invalidated (e.g. reallocation occurred, or the string was destroyed)

Looks like chai tries to convert my custom class to a std::string (for which a chaiscript::type_conversion is indeed added).

So… which way to go to get this working ?