Когда я пытаюсь передать динамический параметр функции в аргумент std::make_unique, почему clangd возвращает мне ошибку?
В шаблоне: нет соответствующей функции для вызова 'construct_at' [ovl_no_viable_function_to_call]
Часть кода, которая возвращает мне ошибка:
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
this->integers = std::make_unique(integers);
}
Следующий код также возвращает ошибку:
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
std::vector temp;
this->integers = std::make_unique(temp);
}
И если я передам статически инициализированный параметр в аргумент std::make_unique, то clangd не вернет мне никакой ошибки:
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
this->integers = std::make_unique(std::vector());
}
Я предполагаю, что проблема здесь связана с std::vector?
Пример кода вы можете найти ниже:
Вы можете найти пример кода ниже:
p>
#pragma once
#ifndef TURBOINI_DATATYPES_HPP
#define TURBOINI_DATATYPES_HPP
#include
#include
#include
namespace TurboINI
{
namespace DataTypes
{
template class DataType
{
std::unique_ptr key = std::make_unique();
std::unique_ptr value = std::make_unique();
public:
explicit DataType();
const void SetKey(const std::string &key), SetValue(const T &value);
const std::string &GetKey() const;
const T &GetValue() const;
};
class integer : public DataType
{
public:
integer();
integer(const std::string &key);
integer(const std::string &key, const long long &value);
};
class string : public DataType
{
public:
string();
string(const std::string &key);
string(const std::string &key, const std::string &value);
};
class section
{
std::unique_ptr integers = std::make_unique();
std::unique_ptr strings = std::make_unique();
std::unique_ptr sections = std::make_unique();
public:
section();
const void SetIntegers(const std::vector &integers),
SetStrings(const std::vector &strings), SetSections(const std::vector §ions);
};
} // namespace DataTypes
} // namespace TurboINI
template TurboINI::DataTypes::DataType::DataType()
{
}
template const void TurboINI::DataTypes::DataType::SetKey(const std::string &key)
{
*this->key = key;
}
template const void TurboINI::DataTypes::DataType::SetValue(const T &value)
{
*this->value = value;
}
template const std::string &TurboINI::DataTypes::DataType::GetKey() const
{
return *key;
}
template const T &TurboINI::DataTypes::DataType::GetValue() const
{
return *value;
}
TurboINI::DataTypes::integer::integer()
{
}
TurboINI::DataTypes::integer::integer(const std::string &key)
{
SetKey(key);
}
TurboINI::DataTypes::integer::integer(const std::string &key, const long long &value) : integer(key)
{
SetValue(value);
}
TurboINI::DataTypes::string::string()
{
}
TurboINI::DataTypes::string::string(const std::string &key)
{
SetKey(key);
}
TurboINI::DataTypes::string::string(const std::string &key, const std::string &value) : string(key)
{
SetValue(value);
}
TurboINI::DataTypes::section::section()
{
}
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
this->integers = std::make_unique(integers);
}
const void TurboINI::DataTypes::section::SetStrings(const std::vector &strings)
{
}
#endif // TURBOINI_DATATYPES_HPP
Подробнее здесь: https://stackoverflow.com/questions/792 ... -an-stdmak
Почему clangd C++ возвращает мне ошибку, когда я пытаюсь передать динамический параметр функции std::make_unique в качес ⇐ C++
Программы на C++. Форум разработчиков
1733173132
Anonymous
Когда я пытаюсь передать динамический параметр функции в аргумент std::make_unique, почему clangd возвращает мне ошибку?
В шаблоне: нет соответствующей функции для вызова 'construct_at' [ovl_no_viable_function_to_call]
Часть кода, которая возвращает мне ошибка:
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
this->integers = std::make_unique(integers);
}
Следующий код также возвращает ошибку:
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
std::vector temp;
this->integers = std::make_unique(temp);
}
И если я передам статически инициализированный параметр в аргумент std::make_unique, то clangd не вернет мне никакой ошибки:
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
this->integers = std::make_unique(std::vector());
}
Я предполагаю, что проблема здесь связана с std::vector?
Пример кода вы можете найти ниже:
Вы можете найти пример кода ниже:
p>
#pragma once
#ifndef TURBOINI_DATATYPES_HPP
#define TURBOINI_DATATYPES_HPP
#include
#include
#include
namespace TurboINI
{
namespace DataTypes
{
template class DataType
{
std::unique_ptr key = std::make_unique();
std::unique_ptr value = std::make_unique();
public:
explicit DataType();
const void SetKey(const std::string &key), SetValue(const T &value);
const std::string &GetKey() const;
const T &GetValue() const;
};
class integer : public DataType
{
public:
integer();
integer(const std::string &key);
integer(const std::string &key, const long long &value);
};
class string : public DataType
{
public:
string();
string(const std::string &key);
string(const std::string &key, const std::string &value);
};
class section
{
std::unique_ptr integers = std::make_unique();
std::unique_ptr strings = std::make_unique();
std::unique_ptr sections = std::make_unique();
public:
section();
const void SetIntegers(const std::vector &integers),
SetStrings(const std::vector &strings), SetSections(const std::vector §ions);
};
} // namespace DataTypes
} // namespace TurboINI
template TurboINI::DataTypes::DataType::DataType()
{
}
template const void TurboINI::DataTypes::DataType::SetKey(const std::string &key)
{
*this->key = key;
}
template const void TurboINI::DataTypes::DataType::SetValue(const T &value)
{
*this->value = value;
}
template const std::string &TurboINI::DataTypes::DataType::GetKey() const
{
return *key;
}
template const T &TurboINI::DataTypes::DataType::GetValue() const
{
return *value;
}
TurboINI::DataTypes::integer::integer()
{
}
TurboINI::DataTypes::integer::integer(const std::string &key)
{
SetKey(key);
}
TurboINI::DataTypes::integer::integer(const std::string &key, const long long &value) : integer(key)
{
SetValue(value);
}
TurboINI::DataTypes::string::string()
{
}
TurboINI::DataTypes::string::string(const std::string &key)
{
SetKey(key);
}
TurboINI::DataTypes::string::string(const std::string &key, const std::string &value) : string(key)
{
SetValue(value);
}
TurboINI::DataTypes::section::section()
{
}
const void TurboINI::DataTypes::section::SetIntegers(const std::vector &integers)
{
this->integers = std::make_unique(integers);
}
const void TurboINI::DataTypes::section::SetStrings(const std::vector &strings)
{
}
#endif // TURBOINI_DATATYPES_HPP
Подробнее здесь: [url]https://stackoverflow.com/questions/79245442/why-does-cs-clangd-return-me-an-error-when-i-am-trying-to-pass-to-an-stdmak[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия