equal operator for intArray

The engine.
Post Reply
nordic
Posts: 14
Joined: Wed Sep 25, 2013 5:16 pm

equal operator for intArray

Post by nordic » Fri Nov 29, 2013 5:39 pm

hi,

i want to compare two int array's with the == operator, which i got returned from DSL_node::Parents(), I know that they got euqal parents, but the comparison doesn't say so. When i iterate over the intArray from 0, to DSL_intArray::NumItems() it behaves like expected, so now my question could it be that the == operator allways compares the vector version? Or what's wrong with my usage. Again the intArrays were returned from DSL_node::Parents() and i didn't modify anything.

Thanks in advance,
nordic

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: equal operator for intArray

Post by shooltz[BayesFusion] » Fri Nov 29, 2013 6:03 pm

Unfortunately, the DSL_intArray::noperator== is broken. This is related to really old issue; I suggest that you write your own function iterating over elements from 0 to NumItems() - 1.

nordic
Posts: 14
Joined: Wed Sep 25, 2013 5:16 pm

Re: equal operator for intArray

Post by nordic » Fri Nov 29, 2013 6:32 pm

Ahh, ok...
Thanks for the quick request, just like allways

nordic
Posts: 14
Joined: Wed Sep 25, 2013 5:16 pm

Re: equal operator for intArray

Post by nordic » Fri Nov 29, 2013 9:48 pm

Am i right, with the assumption that the equaloperator is fully functional for every other array class, like for example DSL_doubleArray?

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: equal operator for intArray

Post by shooltz[BayesFusion] » Tue Dec 03, 2013 1:29 pm

nordic wrote:Am i right, with the assumption that the equaloperator is fully functional for every other array class, like for example DSL_doubleArray?
Unfortunately, the issue with operator= is related to fundamental problem with DSL_xxxArray classes (the possibility of different returns from NumItems() and GetSize()).

What are the sources of DSL_doubleArrays you want to compare? Do they come from node definitons or values?

nordic
Posts: 14
Joined: Wed Sep 25, 2013 5:16 pm

Re: equal operator for intArray

Post by nordic » Tue Dec 03, 2013 2:38 pm

ok, then i just iterate over the arrays by myself... I'm using it in my unit-tests, so principal they could come from anywhere =)..

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: equal operator for intArray

Post by shooltz[BayesFusion] » Tue Dec 03, 2013 2:57 pm

nordic wrote:ok, then i just iterate over the arrays by myself... I'm using it in my unit-tests, so principal they could come from anywhere =)..
That's the core of the problem with DSL_xxxArray object coming from anywhere - you won't be able to decide between NumItems() and GetSize() when choosing the iteration count.

Post Reply