gpt4 book ai didi

c++ - C++中的前向声明

转载 作者:行者123 更新时间:2023-11-30 01:31:11 34 4
gpt4 key购买 nike

我要转发声明:

namespace boost {
namespace property_tree {
template<typename Key, typename Data, typename KeyCompare = std::less<Key> >
class basic_ptree;
typedef basic_ptree< std::string, std::string > ptree;
}
}

但由于默认模板参数,我的 g++ 对重新定义不满意。我怎样才能做到这一点?

最佳答案

要转发声明 property_tree,您应该包括

#include <boost/property_tree/ptree_fwd.hpp>

header,而不是自己声明一个。

关于c++ - C++中的前向声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3492422/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com