Sign in to follow this  
Jason Goepel

List Pattern

Recommended Posts

Jason Goepel    797

I see the format of the list pattern contains a "repeat" identifier.   It looks like my Matrix class (which contains doubles) would register its list factory like so:

engine->RegisterObjectBehaviour("Matrix", asBEHAVE_LIST_FACTORY, "Matrix@ f(int&in list) {repeat {repeat double}}", ...);

Is there any way to register the list pattern such that the inner lists all must have the same dimension?

Matrix A = { {1.0, 2.0}, {3.0, 4.0} };  // Successful
Matrix B = { {1.0},      {3.0, 4.0} };  // Compile Error

I realize I can inspect the pattern at runtime to determine whether it meets any special criteria.

Edited by Jason Goepel

Share this post


Link to post
Share on other sites
WitchLord    4677

It's not yet possible to declare the pattern to guarantee that all sublists are of the same size, but it is planned. It will look something like this:

 

"Matrix@ f(int&in list) {repeat {repeat(x) double}}"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this