我无法编译下面的代码:提升融合和提升气 - 编译时错误
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/spirit/include/qi.hpp>
#include <string>
struct function
{
std::string ret_type;
std::string name;
};
BOOST_FUSION_ADAPT_STRUCT(
function,
(std::string, ret_type)
(std::string, name)
)
int main() {}
MSVC-11.0升压1.54给了我以下错误:
1>main.cpp(6084): error C3203: 'function' : unspecialized class template can't be used as a template argument for template parameter 'Sequence', expected a real type
1>main.cpp(6084): error C2955: 'boost::function' : use of class template requires template argument list
1> e:\libs\boost_1_54_0\boost\function\function_fwd.hpp(33) : see declaration of 'boost::function'
1>main.cpp(6084): error C2913: explicit specialization; 'boost::fusion::traits::tag_of' is not a specialization of a class template
1>main.cpp(6084): error C3203: 'function' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
1> e:\libs\boost_1_54_0\boost\function\function_fwd.hpp(33) : see declaration of 'boost::function'
1>main.cpp(6084): error C2913: explicit specialization; 'boost::fusion::extension::access::struct_member' is not a specialization of a class template
1> e:\libs\boost_1_54_0\boost\function\function_fwd.hpp(33) : see declaration of 'boost::function'
1>main.cpp(6084): error C2913: explicit specialization; 'boost::fusion::extension::struct_member_name' is not a specialization of a class template
1> e:\libs\boost_1_54_0\boost\function\function_fwd.hpp(33) : see declaration of 'boost::function'
1>main.cpp(6084): error C2913: explicit specialization; 'boost::fusion::extension::struct_size' is not a specialization of a class template
1> e:\libs\boost_1_54_0\boost\function\function_fwd.hpp(33) : see declaration of 'boost::function'
1>main.cpp(6084): error C2913: explicit specialization; 'boost::fusion::extension::struct_is_view' is not a specialization of a class template
1> e:\libs\boost_1_54_0\boost\function\function_fwd.hpp(33) : see declaration of 'boost::function'
1>main.cpp(6084): error C2913: explicit specialization; 'boost::mpl::sequence_tag' is not a specialization of a class template
一切如果我删除了“boost/spirit/include/qi.hpp”,包括或明确说明函数结构放置在全局命名空间内,那么很好:
BOOST_FUSION_ADAPT_STRUCT(
::function,
(std::string, ret_type)
(std::string, name)
)