Recently in change currennt code, I wipe wipe, really can't endure
The most disgusting part of C + + is the pointer reference and object-oriented mixing!! TMD various mismatches
Example:
Template <typename tdevice>void trainablelayer<tdevice>::vectorxvector (real_vector* Destmatrix, Real_ vector* Srcvect1, real_vector* srcvect2) {int vect1size=srcvect1->size (); int vect2size=srcvect2->size (); for ( int row=0;row<vect1size;++row) {for (int col=0;col<vect2size;++col) {//real_t Value=srcvect1[row]*srcvect2[col ];?}}}
Code content don't mind, just say this real_vector, is an object, need to pass with the pointer
But this object is the thrust library implementation, want to access the elements in the Real_vector, only the overloaded [] can be used, that is real_vector[i] so ...
I rub, then here I how to use Ah!! Suppose Real_vector's pointer is P:
*p->[] is not allowed at the grammatical level. *p->get (i) is not implemented. P[i] Access to the content is not the vector I want to the first element of the ...
This is the result of giving the people too much flexibility, and finally it is this way of passing each other!
If overloading is not allowed, real_vector you honestly give me a get function, I can use it here!
---------------
All right...... I'm out, check it out, I need to dereference it before I can use the overload.
(*p) I
But it also reflects the C + + syntax is too flexible ~ really feel that learning this rule usage is a waste of time ...
Reference
http://www.cplusplus.com/forum/beginner/28033/
[Spit Groove] why I hate C + +