Код: Выделить всё
#include
#include
#include
#include
#include
#include
template< typename ... Args >
class Identifier: public std::tuple< Args... >
{
public:
Identifier( Args... args ) requires( sizeof...( Args ) != 0 ) : std::tuple< Args... >( std::move( args )... )
{}
Identifier( std::tuple< Args... > tuple ):std::tuple< Args... >( tuple )
{}
Identifier()
{}
Identifier(std::convertible_to auto&& identifier)
: std::tuple(std::forward(identifier)) {}
};
int main()
{
Identifier id(L"id", 10);
auto& [ str_id, num_id ] = id;
std::tuple< std::wstring, int64_t > tuple_id(L"id", 10);
auto& [ str_t_id, num_t_id ] = tuple_id;
return 0;
}
< /code>
в строке < /p>
auto& [ str_id, num_id ] = item;
< /code>
Я получил тип ошибки Предоставлено < /p>
, но тот же код для переменной кортежей это OK < /p>
auto& [ str_t_id, num_t_id ] = tuple_id;
Подробнее здесь: https://stackoverflow.com/questions/794 ... from-tuple