提升库(Boost): 什么是“方便头文件”?

6
在Boost库中,“header”和“convenience header”的区别是什么?
2个回答

16

便利头文件通常是指(不仅仅是在Boost中)一个包含一些其他头文件的头文件,这些头文件包含了通常一起使用的实际代码,尽管它们之间没有硬依赖关系(这也是它们最初分开的原因)。


7

这里包含了很多不同但相关的头文件。

例如,boost/smart_ptr.hpp 包括共享指针和作用域指针容器:

//
//  smart_ptr.hpp
//
//  For convenience, this header includes the rest of the smart
//  pointer library headers.
//
//  Copyright (c) 2003 Peter Dimov  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)
//
//  http://www.boost.org/libs/smart_ptr/smart_ptr.htm
//

#include <boost/config.hpp>

#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/shared_array.hpp>

#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES)
# include <boost/weak_ptr.hpp>
# include <boost/intrusive_ptr.hpp>
# include <boost/enable_shared_from_this.hpp>
#endif

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接