Программы на C++. Форум разработчиков
-
Anonymous
Правильное определение шаблона функции для прямой ссылки на массив и тип элемента
Сообщение
Anonymous »
Минимальный рабочий пример:
Код: Выделить всё
#include
#include
template struct is_array : std::false_type {};
template struct is_array : std::true_type {};
template
std::enable_if_t
do_something_prob(T&& arr, typename T::value_type mul) // `arr` becomes an rvalue?
{
for (auto && v : arr)
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78368151/function-template-correct-definition-for-forward-reference-to-an-array-and-type[/url]
1732921285
Anonymous
Минимальный рабочий пример:
[code]#include
#include
template struct is_array : std::false_type {};
template struct is_array : std::true_type {};
template
std::enable_if_t
do_something_prob(T&& arr, typename T::value_type mul) // `arr` becomes an rvalue?
{
for (auto && v : arr)
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78368151/function-template-correct-definition-for-forward-reference-to-an-array-and-type[/url]