williamwong:
- Hi,
I encountered a bug in CQueue, not sure how to report it. The underline code is not correct.
You are right, I confirm it and your solution.
Please note this other one too :
![[Suspected bug] CQueue::CopyTo error [Suspected bug] CQueue::CopyTo error](https://c.mql5.com/36/85/suspected-bug-cqueue-copyto-error.jpg)
[Suspected bug] CQueue::CopyTo error
- 2023.02.19
- pperea21
- www.mql5.com
Hi, I've found that CopyTo method has a mistake Original code is : When CQueue is full it returns less elements than it actually has: Error is in C...
Thank you all
Fixed
template<typename T> int CQueue::CopyTo(T &dst_array[],const int dst_start=0) { //--- resize array if((dst_start+m_size)>ArraySize(dst_array)) if(ArrayResize(dst_array,dst_start+m_size)<0) return(0); //--- copy queue elements from head to tail if(m_tail>m_head) return(ArrayCopy(dst_array,m_array,dst_start,m_head,m_size)); //--- copy queue elements from head to end int num_copied=ArrayCopy(dst_array,m_array,dst_start,m_head,m_array.Size()-m_head); //--- copy queue elements from beginning to tail num_copied+=ArrayCopy(dst_array,m_array,dst_start+num_copied,0,m_tail); //--- return number of copied elements return(num_copied); }

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
I encountered a bug in CQueue, not sure how to report it. The underline code is not correct.