Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class T>
- bool &operator == (const MSArray<T> &vec1, const MSArray<T> &vec2)
- {
- if (vec1.size() != vec2.size()) // if the two MSArrays arent even the same size
- { // just leave because they can't be equal
- return false;
- }
- for (int i = 0; i < vec1.size(); ++i)
- {
- if (vec1.msarray_[i] != vec2.msarray_[i])//go through the whole vector and if each elment is equivalent
- { //then it won't return false and will break from the loop
- return false;
- }
- }
- return true; // the size was the same and all elments were same so they are ==
- }
- template<class T>
- bool &operator!=(const MSArray<T> &vec1, const MSArray<T> &vec2)
- {
- return !(vec1 == vec2) // return the opposite of == operator
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement