Category : operator-overloading

Here’s the code: #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <utility> struct student { std::string full_name; int group; int number; friend std::istream& operator>>(std::istream& in, student& obj) { in >> obj.full_name >> obj.group >> obj.number; return in; } friend std::ostream& operator<<(std::ostream& out, const student& obj) { out << "Full name: " << obj.full_name << ..

Read more

I’m trying to define an operator==() for a custom stack implementation, but unfortunately my code doesn’t compile: #include <iostream> namespace ft { template <class T, class Alloc = std::allocator<T> > class vector { public: T element; typedef size_t size_type; bool empty() const { return (true); } size_type size() const { return (0); } T &top() ..

Read more