yuwen 0 Report post Posted April 13, 2022 Hi, I am trying to create an Flist containing Fdouble values, and would like to use the .sort() class function to sort the values within the list. However, when i do that, i got an error, *** ERROR Command Control : failure [invalid expression "|04_partision|clean_partision_gen1:Wing_x_loc_array.maxElement()": Cannot execute non-const command on const object]. May i know what does it mean by a non-const command and const object ? Thank you. Yuwen Share this post Link to post Share on other sites
Mr. Heinrich von Zadow 5 Report post Posted April 13, 2022 Hi Yuwen, it usually means that you try to modify an object that you are not allowed to (in order to prevent recursion). If you just need the max value, you could (inside a feature) use a doubleSeries like this: FDoubleSeries values([1,2,3,4,5,4,3,2,1]) FDouble maxVal(values.getMax()) Cheers, Heinrich Share this post Link to post Share on other sites
yuwen 0 Report post Posted April 14, 2022 Hi Heinrich, Thanks for the reply. How about if i want to sort an array in an ascending order ? One of the reason I want to use FList is because it seems to be the only type that has a built-in sorting feature, but apparently it has the same recursion issue. Is there any other object that allows me to return an sorted array from an input Fdouble/Finteger array ? Thank you. Yuwen Share this post Link to post Share on other sites
Mr. Heinrich von Zadow 5 Report post Posted April 19, 2022 Hi Yuwen, at this moment we don't really have this kind of functionality. However, you might want to check again after the next release 😉 In the meantime I attached a quicksort algorithm feature from this old post from Arne: Cheers, Heinrich quicksort.fdf Share this post Link to post Share on other sites
yuwen 0 Report post Posted April 21, 2022 Hi Herich, Ok, thanks for the code. Yuwen Share this post Link to post Share on other sites