У меня есть следующая концепция:
Код: Выделить всё
template
concept move_input_iterator = std::input_iterator && std::same_as;
Код: Выделить всё
template
sound create_sound(const sound_details& details, Iter begin, Iter end)
{
return sound{
.details = details,
.samples = {begin,end}
};
}
Код: Выделить всё
sounds[sound_key] = create_sound(
{
.pitch_min = short(sound_info->pitch_min),
.pitch_max = short(sound_info->pitch_max),
.volume_min = short(sound_info->volume_min),
.volume_max = short(sound_info->volume_max),
.is_looped = /*TODO:*/ true,
.radius = /*TODO:*/ 0,
},
std::make_move_iterator(samples.begin()),
std::make_move_iterator(samples.end()));
Код: Выделить всё
sound::samplesЯ получаю следующую ошибку:
Код: Выделить всё
Game/src/common/sound.h:33:8: note: candidate template ignored: constraints not satisfied [with Iter = move_iterator]
33 | sound create_sound(const sound_details& details, Iter begin, Iter end)
| ^
Game/src/common/sound.h:32:12: note: because 'move_input_iterator' evaluated to false
32 | template
| ^
Game/src/common/iterator.h:12:61: note: because 'std::same_as' evaluated to false
12 | concept move_input_iterator = std::input_iterator && std::same_as;
| ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../include/c++/15.2.1/concepts:65:9: note: because '__detail::__same_as' evaluated to false
65 | = __detail::__same_as && __detail::__same_as;
| ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../include/c++/15.2.1/concepts:59:27: note: because 'std::is_same_v' evaluated to false
59 | concept __same_as = std::is_same_v;
когда std::make_move_iterator должен выполнить итератор перемещения (что должно привести к звуковому_образцу&&?)
Подробнее здесь: https://stackoverflow.com/questions/797 ... t-iterator
Мобильная версия