Hello, Let's assume I have a "Vec" class which is a wrapper of std::vector. The only private variable of "Vec" is just a std::vector object....
No, d(0)=d(1)=d(2) = 8. There is an easy way to solve all posibilities no matter if it is integer or double. I found it today in the morning:...
The correct constructor is: template<class T> Vec<T>:: Vec(const Vec<T>& rhsObj) { myVec_ = rhsObj.myVec_; } or template<class...
Yes, I tried. It is being invoked.
the code above is just a portion of another code that does some operations with vectors. At the beggining I created it as a child of std::vector,...
Can somebody tell me why this code does not work and how to fix it? It compiles but runtime errors appear: #include <iostream> #include...
GNU compiler will produce an error because there is no *= that matches the overloaded operators in std::vector class.
Hello all, can anyone tell me how can i make the following code to work fine in MVS and GNU compiler? This code will work only for MVS. GNU...
ultimately what I want to do is to use my 'Vec' class in conjunction with a matrix class 'Mat', where the objects are accessed as m(i,j), so I...
Hello, Let's say we have a 'Vec' class that it is defined using the vector class. Also, let's assume i have overloaded the function operator,...
I am using GNU compiler under redhat enterprise linux 9.0. First of all I didn't use resize in my last part of the code, I used SIZE to show...
For your reference. Try this code and you will experiment such inconsistencies. #include <iostream> #include <vector> using namespace...
Thanks for your reply. I found the answer to the problem. In brief is in using reserve() and then access with [] whould work for such types like...
Finally, I understood how to use your USE_PUSH. But I still don't understand why direct access work when I used reserve() method.
thanks for your reply. I don't understand how your #define USE_PUSH works. Another thing, my question is precisely because reserve() method does...
Hello, could someone explain me why this two codes work? I got surprised when I found out that I can use either push_back() method or direct...
Thanks for your reply. I have tested another two way to do what you did with vectors above. The first is returning a vector object by value which...
Actually, I found the answer. So no reply is needed.
Hello, both codes below do exactly the same and both are working. Here is my question for those more experienced. Which of the two codes below...
Hello, I am trying to rewrite the two snippets below using the vector class. Can anyone guide me in how to do it? For example, can I return a...
Separate names with a comma.