-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set no more compatible with Collection #32
Comments
Still it doesn't work to make a simple Set of Integers for example:
Error is: Cannot instantiate abstract class I dont find the reason but my changes above are not enough. |
As you can see, |
@JJJHawk Hi what @yerden said is a future state, where the Set is an abstract class. You can use HashSet though, which is a concrete class that can be instantiated. Now the Set is an array based concrete implementation, but it is in a broken state as recently the collection classes had gone through a rather big refactoring and I don't have time to make it an ArraySet and turn the Set into an abstract interface. Sorry for the inconvenience. I will spend some time to close this issue. Thank you for answering questions @yerden and your recent pull requests will be processed as soon as I have some time. |
Hello Yerden, yes I understand. That is why I changed the constructor in the Set-Class to:
which I took from the Vector Class, but unfortunately it doesn't help. The line I switched to Vector now and my code works again. Its OK. But I dont need any sorting mechanism so a set would be the better choice. I simply need Contains(). Its just a bucket for strategies with which I fill the EA. Like {1,3,4} means do strategies 1,3,4. |
Hi Ding Li, thank you very much for your answer which fits my last comment. Great work ! Thumbs Up! Greetings |
Hi Ding Li,
still I dont know how to make pull requests, so here is what I did local to make Set work again. I dont know, if that is all what is todo. But at least it should be the compatibility with the new iterator interface and with the new Collection constructor.
Greetings
Martin
` Collection/Set.mqh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Collection/Set.mqh b/Collection/Set.mqh
index efe3ee0..b6234c7 100644
--- a/Collection/Set.mqh
+++ b/Collection/Set.mqh
@@ -34,7 +34,7 @@ public:
// Iterator interface
Iterator*iterator() const {return new SetIterator(m_array);}
// for Set initial buffer set to zero
void clear() {m_array.clear();}
int size() const {return m_array.size();}
@@ -89,5 +89,9 @@ public:
void next() {if(!end()){m_index++;}}
T current() const {return m_a[m_index];}
bool set(T value) {m_a.set(m_index,value);return true;}
//+------------------------------------------------------------------+
`
The text was updated successfully, but these errors were encountered: