Skip to content

New feature#2

Open
ZergLev wants to merge 2 commits intomainfrom
new_feature
Open

New feature#2
ZergLev wants to merge 2 commits intomainfrom
new_feature

Conversation

@ZergLev
Copy link
Owner

@ZergLev ZergLev commented Apr 4, 2023

No description provided.

@ZergLev ZergLev self-assigned this Apr 4, 2023
Copy link

@artem-lukanin artem-lukanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сергей, добрый день!
В целом очень хорошо. Оставил комментарии.

#include <iostream>
#include <cmath>

//

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Использование конструкций switch/case для данного случая (проверок true/false) загромождает код и затрудняет его понимание. Лучше использовать обычный if/else.

#include <string>
#include <stdlib.h>

//

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Можно вынести в приватную секцию поля number и email классов SmsNotifier и EmailNotifier соответственно.
  2. Метод Notify() классов является константным, поэтому можно передавать параметр notifier в функцию Notify() по константной ссылке.

#include <vector>
#include <map>

//

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

	int array[3];
	cin >> array[1] >> array[2] >> array[3];

Итерация в массиве с нуля.
Может возникнуть:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

#include <vector>
#include <algorithm>

//

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Инициализация пустой строки производится конструктором по умолчанию класса string, поэтому можно так не писать: string input = "";
  2. Для вывода вектора могли использовать свою перегрузку оператора <<)
  3. В функцию split_string() можно передавать строку по константной ссылке, но тогда нужно использовать константный тип итераторов (string::const_iterator) или просто использовать ключевое слово auto.
  4. Лучше вместо метода string::copy() воспользоваться алгоритмом copy() или сразу конструктором строки, принимающим два итератора. Тогда не нужно будет заводить массив char'ов.

#include <iostream>
#include <mylib.h>

//

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Папку build не добавляем в репозиторий, лучше сразу ее имя добавить в файл .gitignore, тогда она не будет отображаться в списке untracked файлов.
  2. Проблема, про которую Вы мне писали, что не получается собрать проект после git clone репозитория, заключается в том, что у Вас используется сабмодуль. Чтобы его подтянуть, нужно: или использовать специальный флаг при clon'е (git clone --recursive), или после клона выполнить команду git submodule update --init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants