Почему make unique не включается
Forum rules
POSTS HERE ARE PRIVATE. INSTRUCTIONS BELOW:
ALL posts made in this forum are ‘ Private‘ so that only you and staff can see them. This allows sharing of personal data, projects and other information. Posts are generally made public after they are marked ‘Solved’ AND there was no personal data contained in them. If you don’t want your post made public let the team know.
We know it’s frustrating when things don’t work. However, please help us to help you by following these suggestions:
- Update — Before trying anything else. Download and install the latest version of FL Studio from here. Your bug may be fixed already!
- Update plugins — If you are using 3rd party plugins. Look at crash logs for their names. Install the latest version for any you spot. See also Plugins Behaving Badly
- Simple clear explanation — Explain what you are doing, or trying to do, and exactly what is happening.
- Specific information — a) FL Studio version & build number, b) what you are doing and what happens exactly, c) step-by-step instructions how reproduce the problem.
- Screenshots — Another great way to demonstrate issues. Get a free screenshot app here. Include images using the ‘Attachments’ tab, at the bottom of the post edit window.
- A video — The best way of demonstrating many issues. Windows 10 includes an integrated screen recorder, see here OR get a free free recorder here. Include mp4 videos to your post from the ‘Attachments’ tab, at the bottom of the post edit window.
- Use English — Google Translate your post. Short simple sentences in your original language translate best. We are happy to work this way, no need to worry.
NOTE: Technical Support is ONLY available Monday — Friday (9 am to 5 pm Central European Time), thank you.
Источник
Создание регистратора spdlog — make_unique не компилируется
я хочу иметь регистратор spdlog в своем классе в качестве частного члена, что даже предлагается в документации. Первое разочарование: нет конструктора копирования или перемещения для spdlog::logger. Так что, если я хочу более сложный регистратор, мне придется прыгать через некоторые обручи. давайте проигнорируем это и просто используем unique_ptr.
Я не могу создать уникальный указатель из регистратора с помощью make_unique. Хотя «вручную» работает нормально.
Почему вызов make_unique не работает?
Исправлено форматирование кода. (На этом сайте вам не следует использовать
, потому что он плохо работает с символами <> . Делайте отступ в коде четырьмя пробелами — и самый простой способ — выделить код, а затем нажать « <> » в верхней части окна редактора.)
Шаблон функции не может вывести быть типом аргумента для списка инициализатора (список инициализации в фигурных скобках), поэтому вы не можете использовать его с такими функциями, как make_unique , которые выводят все своих (переменных) аргументов. Компилятор не может просмотреть функцию, чтобы увидеть конструкторы spdlog::logger , но с прямым new он может пытаться интерпретировать список инициализаторов с точки зрения (соответствующего параметра) каждого конструктора во время разрешения перегрузки.
(Можно передать явные аргументы шаблона, чтобы избежать необходимости вывода, но это, по крайней мере, громоздко и часто запрещено (для стандартной библиотеки).)
make_unique является шаблоном функции и не может сделать вывод, что вам нужен spdlog::sinks_init_list в качестве второго аргумента конструктора.
Что будет работать, так это следующее: std::make_unique («logger», spdlog::sinks_init_list
Другие вопросы по теме
Похожие вопросы
Находите ответы на сложные технические вопросы по программированию, с которыми сталкиваются инженеры по всему миру в своей ежедневной практике на сайте RedDeveloper.
Источник
Почему make unique не включается
Forum rules
POSTS HERE ARE PRIVATE. INSTRUCTIONS BELOW:
ALL posts made in this forum are ‘ Private‘ so that only you and staff can see them. This allows sharing of personal data, projects and other information. Posts are generally made public after they are marked ‘Solved’ AND there was no personal data contained in them. If you don’t want your post made public let the team know.
We know it’s frustrating when things don’t work. However, please help us to help you by following these suggestions:
- Update — Before trying anything else. Download and install the latest version of FL Studio from here. Your bug may be fixed already!
- Update plugins — If you are using 3rd party plugins. Look at crash logs for their names. Install the latest version for any you spot. See also Plugins Behaving Badly
- Simple clear explanation — Explain what you are doing, or trying to do, and exactly what is happening.
- Specific information — a) FL Studio version & build number, b) what you are doing and what happens exactly, c) step-by-step instructions how reproduce the problem.
- Screenshots — Another great way to demonstrate issues. Get a free screenshot app here. Include images using the ‘Attachments’ tab, at the bottom of the post edit window.
- A video — The best way of demonstrating many issues. Windows 10 includes an integrated screen recorder, see here OR get a free free recorder here. Include mp4 videos to your post from the ‘Attachments’ tab, at the bottom of the post edit window.
- Use English — Google Translate your post. Short simple sentences in your original language translate best. We are happy to work this way, no need to worry.
NOTE: Technical Support is ONLY available Monday — Friday (9 am to 5 pm Central European Time), thank you.
Источник