Advertisement

List Pattern

Started by October 11, 2013 05:12 PM
1 comment, last by Jason Goepel 11 years, 1 month ago

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.

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}}"

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Excellent.

This topic is closed to new replies.

Advertisement