Bah.
The compiler and I seem to be at odds. Implementation is done. Now it's the testing stage.
In the following,
The compiler should call CThreadCPPType(const CThreadCPPType<T>&) to construct a temporary object to return. However, this is also where the error lies. It generates a built-in constructor for it, which means it will not initialize the critical section and therefore crash.Code:TT TNewT CThreadCPPType<T> CThreadCPPType<T>::operator + (const NewT Data) const { Lock(); CThreadCPPType<T> Temp = CCPPType::operator + (Data); Unlock(); return Temp; }
But I seem to have added overloads for all necessary constructors:
Indeed, when looking at the assembly, I can clearly see that it's calling the function:Code:CThreadCPPType(); explicit CThreadCPPType(bool bLogging); TNewT CThreadCPPType(NewT NewData, bool bLogging = false); TNewT CThreadCPPType(const CCPPType<NewT>& Data); TNewT CThreadCPPType(const CThreadCPPType<NewT>& Data);
Yet the compiler will not call my constructor.Code:CThreadCPPType<int>::CThreadCPPType<int>(const CThreadCPPType<int> &)
I've also found that it will call one of these constructors if they exist:
But it will never either of these constructors:Code:CThreadCPPType(const CThreadCPPType<int>&) CThreadCPPType(const CThreadCPPType<T>&)
The error occurs at the lineCode:TNewT CThreadCPPType(const CCPPType<NewT>& Data); TNewT CThreadCPPType(const CThreadCPPType<NewT>& Data);
In the test source code.Code:MyInt = MyInt + 100;
I don't know what the heck is going on right now, so I'll keep investigating. But if someone knows, it would spare some headache.
I'll upload latest source.
Heh, out of the 21 tests, some still fail:
Test 1: Success!
Test 2: Success!
Test 3: Failure!
Test 4: Failure!
Test 5: Failure!
Test 6: Success!
Test 7: Success!
Test 8: Failure!
Test 9: Failure!
Test 10: Failure!
Test 11: Failure!
Test 12: Failure!
Test 13: Failure!
Test 14: Failure!
Test 15: Failure!
Test 16: Success!
Test 17: Failure!
Test 18: Failure!
Test 18: Failure!
Test 19: Failure!
Test 20: Success!
Test 21: Failure!



LinkBack URL
About LinkBacks




I think you'd have to pass the Lower/Upper bounds through the constructor for float & double.