简体   繁体   English

C ++中的前向声明

[英]forward declaration in c++

I want to forward declare: 我想转发声明:

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;
    }
}

but my g++ cribs about redefinition due to default template argument. 但是由于默认的模板参数,我的g ++希望重新定义。 How can I achieve this? 我该如何实现?

To forward-declare the property_tree, you should include the 要向前声明property_tree,您应包括

#include <boost/property_tree/ptree_fwd.hpp>

header, instead of declaring one yourself. 标头,而不是自己声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM