Help with OOP - page 9

 
fxsaber #:

It's not about my implementation. You can measure it the old-fashioned way.

I already did. The data is published. I will try again in a different order. But even according to your data there is no performance from working with an asterisk.
 
However, I would like to hear a reasoned opinion in favour of working with signposts. All that has been expressed so far is: "supposedly faster", "supposedly forces the programmer to watch the memory and not to allocate unnecessary space" and "you're a fool".
 
Vasiliy Sokolov #:
Nevertheless, I would like to hear a reasoned opinion in support of working with pointers. All that has been expressed so far is: "allegedly faster", "allegedly makes programmers watch the memory and not allocate unnecessary space" and "you're a fool" - of course.

Left-right confused too or not?

It's just an outrageous mess in the head. Pointers are slower, not faster. About the need to watch out for memory the talk was in the context of the differences of programming style in languages with and without Garbage Collector.

Vasya, you don't remember what position you took in the argument after 2-3 posts already, it's going this way and that that way.

 
fxsaber #:

An example of a potential problem would be good.

Ihor Herasko #:

One more point. It's better to create arrays of objects by means of a pointer. Otherwise you will get an array in stack memory which is very low:

I had an example of stack memory exhaustion just in case of recursive sorting with large amount of data.
The program just hung.

Besides, you may use global declaration and in this case it is not stack memory.
Don't you agree?

 
Ihor Herasko #:

It's not a problem, much less a potential problem. It's just the peculiarities of memory handling in MT. Here is a static array:

And here is a dynamic array:

In this case everything compiles and works.

I agree, but I've never had such volumes in my practice.
As a rule, I need a quick calculation of an indicator "tail", for instance, without calling the built-in indicator (library) function itself,
, therefore, I applied a faster formula-based calculation of indicator values. In this case, the memory consumption in general is very low.
In general, I recommend this approach to all developers in the future to save memory and time of calculation of functions with floating point.
If possible, many data should be converted into integer format - it really speeds up the process.

P.S.: Of course, the above is a case of saving, for example, a few hundred milliseconds.

 
Dmitiry Ananiev:

I'm making a class like this.

Now I want to call an object array:

How then to quickly create an array of objects if the constructor has parameters at global level?

For example? create objects first by changing the constructor and then how do I replace the objects in OnInit with symbols?

May be there is an easier solution?

class Strategy1
{
        Strategy1();
 };

class Strategy2
{
        Strategy (string sym);
}

In the declaration of the Strategy2 class, the name of the class constructor itself lacks "2", otherwise it's not a constructor.