Tôi đã xem qua bài viết này rất lớn: http://pdimov.com/cpp2/simple_cxx11_metaprogramming.htmlvariadic mẫu loại trừ
Trong đoạn mã sau:
template<class A, template<class...> class B> struct mp_rename_impl;
template<template<class...> class C, class... T, template<class...> class B>
struct mp_rename_impl<C<T...>, B>
{
using type = B<T...>;
};
template<class A, template<class...> class B>
using mp_rename = typename mp_rename_impl<A, B>::type;
//...
mp_rename<mp_list<int, float, void*>, std::tuple>; // -> std::tuple<int, float, void*>
// T... will be deduced as int, float, void*
Tại sao C là suy luận như mp_list (thay vì mp_list < int, float , void *>) và T ... là int, float, void *?
Tôi nghĩ rằng Bí quyết là phần mẫu chuyên môn: struct mp_rename_impl < C < T ...>, B>, Nhưng tôi đấu tranh để hiểu tại sao
'A' nào? 'lớp A' hoặc' mẫu lớp A'? –
Jarod42
Tôi đổi tên thành C như bạn đã làm để làm cho nó rõ ràng hơn –