/* * lesson_1.hpp * * Created on: 16 окт. 2021 г. * Author: alexander */ #pragma once /* * main.cpp * * Created on: 22 сент. 2021 г. * Author: alexander */ #include #include #include #include #include struct Person { std::string firstname; std::string lastname; std::optional patronymic; }; struct PhoneNumber { int country_code; int city_code; std::string number; std::optional additional_number; }; class PhoneBook { private: std::vector> m_data; public: PhoneBook(std::istream &file); friend std::ostream& operator<<(std::ostream &out, const PhoneBook &pb); void SortByName(); void SortByPhone(); std::pair> GetPhoneNumber(const std::string &firstname); void ChangePhoneNumber(const Person &p, const PhoneNumber &pn); }; std::optional getOptStr(std::string &s); std::ostream& operator<<(std::ostream &out, const Person &p); bool operator<(const Person &p1, const Person &p2); bool operator==(const Person &p1, const Person &p2); bool operator<(const PhoneNumber &p1, const PhoneNumber &p2); std::optional getOptInt(std::string &s); std::ostream& operator<<(std::ostream &out, const PhoneNumber &p);