Generic Class Library - bugs, description, questions, usage and suggestions - page 29
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
MSDN calls it a ring buffer, I didn't come up with the name.
link to the
...and ending with a conversion to arguments by reference, not just by value.
there may be a problem with the literals
link in the studio
There may be a problem with literals
Lazy to search for that article again, but I've stretched it a bit. A ring single or double linked list is based on a linked list, but the last element stores a link to the very first one.
there may be problems with the literals
A single or double linked list is based on a linked list, but the last item in the linked list stores a link to the very first item.
Most likely, whoever ported these classes just decided to simplify his life by simplifying code. Instead of two pointers m_first and m_last he made one pointer m_head...
Looked at the dotnet sources, and realized the reason. The LinkedList class itself is ported correctly, there's really only one pointer head, which is both the start and the end. So the internal implementation is indeed looped, but the external behavior is not. MQ has an error in the CLinkedNode class (Next and Previous methods). Here's what their original implementation looks like:
And here's how it's ported to MQL:
Maybe they were inattentive and got it wrong.
But in general I'm also a bit surprised about the dotnet implementation. Why wasn't it possible to make two pointers in the list itself (first and last) instead of one head. That would avoid extra checks in above methods of list node, i.e. they would look exactly like MQ now, but everything would work properly. Of course, it would slow down a bit the process of nodes insertion/deletion, but it would speed up iteration over them, which is a much higher priority. Next and Previous are definitely called more often, than added nodes. That's how I did it, I thought the same would be true for melkomsoft. But never mind )
By the way, MQ has another bug in implementation of CLinkedListNode and CRedBlackTreeNode. (except m_value) are intended to be changed solely by the list class itself. No one else has to change them. That's why they are internal fields in dotnet. MQ has created public methods to modify these fields, and at least they would have given them a specific name... but no, just the usual names:
Hi all!
Is there any other way to delete items in CHashMap other than copying them via CopyTo and manually deleting them?
Here are a couple of other things to sink the furnace of the library's poor implementation. Their class CKeyValuePair inherits IComparable interface (and therefore IEqualityComparable too) for some reason, requiring that user type Key should support these interfaces too. Although there's no need in it if we define our own Comparer. In the original one KeyValuePair has no interfaces of course.
If you keep poking around, you'll find even stranger things:
I.e. if you pass a broken pointer into the constructor accidentally, the program will not only continue working in peace but its logic will change, too!
The constructor should look like this:
And noPOINTER_INVALID . And there is a different constructor signature for the default comparer.
Can you tell me why the code doesn't compile?
The problem is in system enums: ENUM_CHART_PROPERTY_DOUBLE, ENUM_CHART_PROPERTY_STRING something is wrong with them. If I use my own enum as a key type, the compilation works too.