Boost:什么是“便利头”?

Asked
Viewd725

6

boost中的“标头”和“便利标头”有什么区别?

2 个答案

15

便捷标头通常是(不仅在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