1
형식 목록이있는 경우 해당 목록의 형식을 variadic 매개 변수로 가져올 수 있습니까? 즉MPL 유형 목록을 가변 식 컨테이너로 어떻게 접을 수 있습니까?
,이에서 가고 싶은 :
boost::mpl::list<foo, bar, baz, quux>
에 :
types<foo, bar, baz, quux>
(중요하지 주문) 여기
내 시도가 fold
을 사용하고 :
typedef boost::mpl::list<foo, bar, baz, quux> type_list;
template <typename... Ts>
struct types {};
template <template <typename... Ts> class List, typename T>
struct add_to_types {
typedef types<T, typename Ts...> type;
};
typedef boost::mpl::fold<
type_list,
types<>,
add_to_types<boost::mpl::_1, boost::mpl::_2>
>::type final_type;
불행하게도이 자리 표시 자에 대해 나에게 오류를 제공합니다
error: type/value mismatch at argument 1 in template parameter list for 'template<template<class ... Ts> class List, class T> struct add_to_types'
error: expected a class template, got 'mpl_::_1 {aka mpl_::arg<1>}'
error: template argument 3 is invalid
error: expected initializer before 'final_type'
화려한이, 마치 마법처럼 일했다! –