You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

自Boost 1.62起,基于boost.Variant的递归pair实现失效问题咨询

我最近在开发中用到了递归pair类型,这里给个简化的示例:这个类型本质是一个pair,其中第一个元素是string,第二个元素可以是int,也可以是另一个同类型的递归pair。最开始我是用Boost.Variant来实现的,代码如下:

#include <boost/variant.hpp>
#include <string>
using namespace std;

typedef boost::make_recursive_variant<
    std::pair<std::string, boost::variant<int, boost::recursive_variant_>>
>::type recursivePair;

typedef boost::variant<int, recursivePair> intPairVar;

内容的提问来源于stack exchange,提问作者Flamefire

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:43:37