Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

List Pattern


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Jason Goepel   Members   -  Reputation: 418

Like
0Likes
Like

Posted 11 October 2013 - 11:12 AM

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, 11 October 2013 - 11:16 AM.


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3361

Like
0Likes
Like

Posted 11 October 2013 - 12:39 PM

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

#3 Jason Goepel   Members   -  Reputation: 418

Like
0Likes
Like

Posted 11 October 2013 - 02:29 PM

Excellent.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS