MSM的转换表使用mpl::vector。默认最大大小为20。您可以使用更改大小
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_VECTOR_SIZE 50
#define BOOST_MPL_LIMIT_MAP_SIZE 50
以允许尺寸达到50。根据文档(https://www.boost.org/doc/libs/1_80_0/libs/msm/doc/HTML/ch05.html),可以通过添加(例如,60)mpl/vector60.hpp和mpl/map60.hpp
在boost/mpl/vector中,我找到了vector50_c.hpp和vector50.hpp文件。vector50.hpp的内容是:
#ifndef BOOST_MPL_VECTOR_VECTOR50_HPP_INCLUDED
#define BOOST_MPL_VECTOR_VECTOR50_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/vector/vector40.hpp>
#endif
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
# define BOOST_MPL_PREPROCESSED_HEADER vector50.hpp
# include <boost/mpl/vector/aux_/include_preprocessed.hpp>
#else
# include <boost/mpl/aux_/config/typeof.hpp>
# include <boost/mpl/aux_/config/ctps.hpp>
# include <boost/preprocessor/iterate.hpp>
namespace boost { namespace mpl {
# define BOOST_PP_ITERATION_PARAMS_1 \
(3,(41, 50, <boost/mpl/vector/aux_/numbered.hpp>))
# include BOOST_PP_ITERATE()
}}
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_VECTOR_VECTOR50_HPP_INCLUDED
1.是否需要添加文件vector60_c.hpp和vector60.hpp?(两者有什么区别?)
1.我在哪里添加它们?内部boost/mpl/vector?
1.如何修改文件?
我对编写vector60.hpp的第一个猜测是:
#ifndef BOOST_MPL_VECTOR_VECTOR60_HPP_INCLUDED
#define BOOST_MPL_VECTOR_VECTOR60_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/vector/vector50.hpp>
#endif
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
# define BOOST_MPL_PREPROCESSED_HEADER vector60.hpp
# include <boost/mpl/vector/aux_/include_preprocessed.hpp>
#else
# include <boost/mpl/aux_/config/typeof.hpp>
# include <boost/mpl/aux_/config/ctps.hpp>
# include <boost/preprocessor/iterate.hpp>
namespace boost { namespace mpl {
# define BOOST_PP_ITERATION_PARAMS_1 \
(3,(51, 60, <boost/mpl/vector/aux_/numbered.hpp>))
# include BOOST_PP_ITERATE()
}}
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_VECTOR_VECTOR60_HPP_INCLUDED
编辑:我尝试运行的最小示例
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_VECTOR_SIZE 60
#include <boost/mpl/vector.hpp>
int main() {
typedef boost::mpl::vector<
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int
> vector_51;
return 0;
}
当前产生错误
/usr/include/boost/mpl/vector.hpp:36:1: fatal error: boost/mpl/vector/vector60.hpp: No such file or directory
36 | # include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_VECTOR_HEADER)
我的首选解决方案是在编译时生成代码的include之前添加一些代码。但是,让我的示例使用自编写的文件将是很好的第一步。
2条答案
按热度按时间ie3xauqp1#
是否需要添加文件vector60_c.hpp和vector60.hpp?(两者有什么区别?)
取决于MSM使用vector还是vector_c。区别:https://www.boost.org/doc/libs/1_80_0/libs/mpl/doc/refmanual/vector-c.html
preprocessed/README.txt中记录了生成丢失文件的方法。
在我的Ubuntu盒子上,我可以:
它生成了文件,并修改了许多现有的头文件,例如。aux_/preprocessed/plain/vector.hpp,现在包含
与之前相比
dpiehjr42#
您可以使用
boost::mp11::mp_list
替换boost::mpl::vector
。这个boost::mp11
库是现代C++11(顾名思义),它没有限制-它只是使用可变模板。对于转换表-您需要记住it does not support inheritance-因此您需要以这种方式替换:
您还需要包含
<boost/mp11/mpl.hpp>
,以便所有boost::mpl
“算法”都可以在boost::mp11
上工作