У меня большой проект, над которым я работаю, и он продолжает давать мне
ошибку C3889: < /p>
error C3889: call to object of class type 'std::equal_to': no matching call operator found
note: could be 'unknown-type std::equal_to::operator ()(_Ty1 &&,_Ty2 &&) noexcept() const'
note: Failed to specialize function template 'unknown-type std::equal_to::operator ()(_Ty1 &&,_Ty2 &&) noexcept() const'
note: With the following template arguments:
note: '_Ty1=const _Ty &'
note: '_Ty2=const _Ty &'
note: binary '==': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
_Ty=Spot
]
< /code>
Я использую код Visual Studio 2022. < /p>
Вот mre: < /p>
#include
#include
template
bool isin(T i, const std::vector& vec) {
for (const T& t : vec) {
if (i == t) return true;
}
return false;
}
template
std::vector GetAllUniqueCombos(const std::vector& arr) {
std::vector n;
for (int i = 0; i < arr.size(); ++i) {
for (int j = i + 1; j < arr.size(); ++j) {
if (!isin({ arr, arr[j] }, n))n.push_back({ arr, arr[j] });
}
}
return n;
}
struct Spot {
int x, y;
};
void DrawTriangle(Spot s1, Spot s2, Spot s3, int color);
void DrawPolygon(const std::vector& points, int color) {
if (points.size() < 3) return;
std::vector a;
for (int j = 1; j < points.size(); j++) {
a.push_back(points[j]);
}
for (auto i : GetAllUniqueCombos(a)) {
DrawTriangle(points[0], i[0], i[1], color);
}
}
int main() {
DrawPolygon({ {25, 25}, {50, 50}, {25, 50}, {50, 25} }, 0xffaa55);
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... ual-tovoid
Почему это дает мне сообщение об ошибке C3889, если я никогда не называл std :: eval_to ? ⇐ C++
Программы на C++. Форум разработчиков
1739305689
Anonymous
У меня большой проект, над которым я работаю, и он продолжает давать мне
ошибку C3889: < /p>
error C3889: call to object of class type 'std::equal_to': no matching call operator found
note: could be 'unknown-type std::equal_to::operator ()(_Ty1 &&,_Ty2 &&) noexcept() const'
note: Failed to specialize function template 'unknown-type std::equal_to::operator ()(_Ty1 &&,_Ty2 &&) noexcept() const'
note: With the following template arguments:
note: '_Ty1=const _Ty &'
note: '_Ty2=const _Ty &'
note: binary '==': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
_Ty=Spot
]
< /code>
Я использую код Visual Studio 2022. < /p>
Вот mre: < /p>
#include
#include
template
bool isin(T i, const std::vector& vec) {
for (const T& t : vec) {
if (i == t) return true;
}
return false;
}
template
std::vector GetAllUniqueCombos(const std::vector& arr) {
std::vector n;
for (int i = 0; i < arr.size(); ++i) {
for (int j = i + 1; j < arr.size(); ++j) {
if (!isin({ arr[i], arr[j] }, n))n.push_back({ arr[i], arr[j] });
}
}
return n;
}
struct Spot {
int x, y;
};
void DrawTriangle(Spot s1, Spot s2, Spot s3, int color);
void DrawPolygon(const std::vector& points, int color) {
if (points.size() < 3) return;
std::vector a;
for (int j = 1; j < points.size(); j++) {
a.push_back(points[j]);
}
for (auto i : GetAllUniqueCombos(a)) {
DrawTriangle(points[0], i[0], i[1], color);
}
}
int main() {
DrawPolygon({ {25, 25}, {50, 50}, {25, 50}, {50, 25} }, 0xffaa55);
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79431115/why-does-this-give-me-error-message-c3889-if-i-never-called-stdequal-tovoid[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия