Errors, bugs, questions - page 2718
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
ArrayResize applied to different arrays.
Or do you want one array with a sequence of values a: 1, 2, 3, 4, 5, 6, 7, 8,... ?
One array. From your variant I saw the possibility of sequential ArrayResize.
One array. From your variant I saw the possibility of sequential ArrayResize.
You can also increment default_a in the constructor, zeroing it to the desired value before ArrayResize.
You can also increment default_a in the constructor, resetting it to the required value before ArrayResize.
For a general task, you can't, because it's not a sequential value.
It's a pity that we have to drag in a static variable, and public as well. It looks crunchy.
How do I create an array of structures where one of the fields is const?
Alternatively:
As an option:
Thank you. After filling the array, you could do ArrayFree(::sdefs).
How do I create an array of structures where one of the fields is const?
What you want is strange. Imho - structures are C entities, we should treat them as POD objects, passive, without constructors and other sugar. You can make a class with setter that contains structure, setter will not allow re-assignment. I think this is more correct from a design point of view.
What you want is strange. Imho - structures are C entities, we should treat them as POD objects, passive, without constructors and other sugar. You can make a class with a setter that contains a structure, the setter will not allow re-assignment. I think this is more correct from a design point of view.
In my opinion, fields that will never (and should never) be changed after creation are logically prescribed const.
In my opinion, fields that will never (and should never) be changed after creation, it is logical to write const.
Well, you also have a constructor. It's up to you, of course, but structures are C entities and the model is different - passive entities with external logic (functions).
Well, they also stuck you with the constructor. It's up to you to decide, of course, but structures are C entities and the model is different - passive entities with external logic (functions).
Constructor only because you can't initialise a const field without it. Structure or class - doesn't make any difference. The main thing is to have an object.