Getting started with boost

Source: Internet
Author: User
Tags bitwise operators define definition event timer greatest common divisor traits wrappers

1. What is boost?
The boost library is a portable C ++ library that provides source code. It covers a wide range of fields, from the mathematical Library to the smart pointer library, from the template meta programming library to the pre-processor library, from the thread to the lambda expression.
Ten
Boost libraries are already encoded in the C ++ Standards Committee's library technical report (tr1) and will be in the new C ++ 0x standard now being finalized. c ++ 0x will also include several more boost libraries in addition to those from
Tr1. more boost libraries are proposed for tr2.

2. What does boost contain?

Accumulators: Framework for incremental calculation, and collection of statistical accumulators.
Any: Safe, generic container for single values of different value types.
Array: STL compliant container wrapper for arrays of constant size.
ASIO: Portable networking, including sockets, timers, hostname resolution and socket iostreams.
Assign: Filling containers with constant or generated data has never been easier.
Bimap: Bidirectional maps library for C ++. With boost. bimap you can create Associative containers in which both types can be used as key.
BIND: bost: BIND is a generalization of the standard functions STD: bind1st and STD: bind2nd. it supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route
Input arguments into arbitrary positions.
Call traits: defines types for passing parameters.
Chrono: useful time utilities.
Circular buffer: a STL compliant container also known as ring or cyclic buffer.
Compatibility: Help for non-conforming standard libraries.
Compressed pair: Empty member optimization.
Concept check: Tools for generic programming.
Config: helps boost library developers adapt to compiler idiosyncrasies; not intended for library users.
Conversion: polymorphic and lexical casts.
CRC: the boost CRC Library provides two implementations of CRC (Cyclic Redundancy Code) computation objects and two implementations of CRC computation functions. The implementations are template-based.
Date time: a set of date-time libraries based on generic programming concepts.
Disjoint Sets: boost. disjointsets provides disjoint sets operations with union by rank and path compression.
Dynamic bitset: The dynamic_bitset class represents a set of bits. it provides accesses to the value of individual bits via an operator [] and provides all of the bitwise operators that one can apply to builtin integers, such as operator & and operator <. the
Number of BITs in the set is specified at runtime via a parameter to the constructor of the dynamic_bitset.
Enable if: Selective compression sion of function template overloads.
Exception: the boost exception Library supports transporting of arbitrary data in exception objects, and transporting of exceptions between threads.
Filesystem: The boost filesystem Library provides portable facilities to query and manipulate paths, files, and directories.
Flyweight: design pattern to manage large quantities of highly redundant objects.
Foreach: In C ++, writing a loop that iterates over a sequence is tedious. we can either use iterators, which requires a considerable amount of boiler-plate, or we can use the STD: for_each () algorithm and move our loop body into a predicate, which requires
No less boiler-plate and forces us to move our logic far from where it will be used. in contrast, some other versions, like Perl, provide a dedicated "foreach" construct that automates this process. boost_foreach is just such a construct for C ++. it iterates
Over sequences for us, freeing us from having to deal directly with iterators or write predicates.
Format: The format Library provides a class for formatting arguments according to a format-string, as does printf, but with two major differences: Format sends the arguments to an internal stream, and so is entirely type-safe and naturally supports all user-defined
Types; the ellipsis (...) can not be used correctly in the stronugly typed context of format, and thus the function call with arbitrary arguments is replaced by successive callto an argument feeding operator %.
Function: function object wrappers for deferred CILS or callbacks.
Function types: boost. functiontypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types.
Functional: the boost. function library contains a family of class templates that are function object wrappers.
Functional/Factory: function Object Templates for dynamic and static object Creation
Functional/forward: adapters to allow generic function objects to accept arbitrary arguments
Functional/HASH: A tr1 hash function object that can be extended to hash user defined types.
Fusion: Library for working with tuples, including various containers, algorithms, etc.
Geometry: geometry library.
GIL: Generic Image Library
Graph: The BGL graph interface and graph components are generic, in the same sense as the standard template library (STL ).
ICL: interval container library, interval sets and maps and aggregation of associated values
In place factory, typed in place Factory: Generic In-Place Construction of contained objects with a variadic argument-list.
Integer: the organization of boost integer headers and classes is designed to take advantage of <stdint. h> types from the 1999 c Standard without resorting to undefined behavior in terms of the 1998 c ++ standard. the header <boost/cstdint. HPP> makes the standard
Integer types safely available in namespace boost without placing any names in namespace STD.
Interprocess: Shared Memory, memory mapped files, process-shared mutexes, condition variables, containers and allocators.
Interval: extends the usual arithmetic functions to mathematical intervals.
Intrusive: intrusive containers and algorithms.
Io state savers: the I/O Sub-library of boost helps segregate the large number of boost headers. this sub-library shoshould contain various items to use with/for the standard I/O library.
Iostreams: boost. iostreams provides a framework for defining streams, stream buffers and I/O filters.
Iterators: the boost iterator library contains two parts. the first is a system of concepts which extend the C ++ standard iterator requirements. the second is a framework of components for building iterators based on these extended concepts and provided des several
Useful iterator adaptors.
Lambda: Define small unnamed function objects at the actual call site, and more.
Lexical cast: General literal text conversions, such as an int represented a string, or vice-versa, from kevlin Henney.
Math: boost. math provided des several contributions in the domain of mathematics: the greatest common divisor and least common multiple Library provides run-time and compile-time evaluation of the greatest common divisor (GCD) or least common multiple (LCM)
Two integers. The special functions library currently provides eight templated special functions, in namespace boost. The complex number inverse trigonometric functions are the inverses of trigonometric functions currently present in the C ++ standard. Category
Are a relative of complex numbers often used to parameterise rotations in three dimentional space. octonions, like quaternions, are a relative of complex numbers.
Math common factor: greatest common divisor and least common multiple.
Math octonion: octonions.
Math quaternion: quaternions.
Math/special functions: a wide selection of mathematical special functions.
Mmember function: generalized binders for function/Object/pointers and member functions.
Meta state machine: a very high-performance library for expressive UML2 finite state machines.
Min-max: Standard Library extensions for simultaneous min/Max and min/MAX Element Computations.
MPI: Message Passing interface library, for use in Distributed-memory parallel application programming.
MPL: the boost. mpl library is a general-purpose, High-Level C ++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. it provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing
Explict metaprogramming in C ++ as easy and enjoyable as possible within the current language.
Multi-array: boost. multiarray provides a generic N-dimen=array concept definition and common implementations of that interface.
Multi-index: the boost multi-index containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics.
Numeric conversion: Optimized Policy-based Numeric conversions.
Operators: templates extends arithmetic classes and iterators.
Optional: discriminated-Union wrapper for optional values.
Parameter: boost. parameter library-Write Functions that accept arguments by name.
Phoenix: Define small unnamed function objects at the actual call site, and more.
Pointer container: containers for storing heap-allocated polymorphic objects to define oo-programming.
Polygon: booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates.
Pool: Memory pool management.
Preprocessor: Preprocessor metaprogramming tools including repetition and recursion.
Program Options: The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file.
Property map: Concepts defining interfaces which map key objects to value objects.
Property tree: A tree data structure especially suited to storing configuration data.
PROTO: expression template library and Compiler Construction toolkit for domain-specific embedded versions.
Python: The boost Python library is a framework for interfacing Python and C ++. it allows you to quickly and seamlessly expose C ++ classes functions and objects to Python, and vice-versa, using no special tools -- just your c ++ compiler.
Random: a complete system for random number generation.
Range: a new infrastructure for generic algorithms that builds on top of the new iterator concepts.
Ratio: compile time rational arithmetic.
Rational: a rational number class.
Ref: a utility library for passing references to generic functions.
RegEx: Regular Expression Library.
Result of: determines the type of a function call expression.
Scope Exit: execute arbitrary code at scope exit.
Serialization: serialization for persistence and grouping alling.
Signals: managed Signals & slots callback implementation.
Signals2: managed Signals & slots callback implementation (thread-safe version 2 ).
Smart PTR: Smart pointer class templates.
Spirit: Ll parser framework represents parsers directly as ebnf grammars in inlined C ++.
Statechart: boost. statechart-arbitrarily complex finite state machines can be implemented in easily readable and maintainable C ++ code.
Static assert: static assertions (compile time assertions ).
String algo: String algorithms library.
Swap: enhanced generic swap function.
System: operating system support, including the diagnostics support that will be part of the C ++ 0x standard library.
Test: Support for simple program testing, full unit testing, and for program execution monitoring.
Thread: Portable C ++ multi-threading.
Timer: Event timer, progress timer, and progress display classes.
Tokenizer: Break of a string or other character sequence into a series of tokens.
Tr1: The tr1 Library provides an implementation of the C ++ Technical Report on standard library extensions. this library does not itself implement the tr1 components, rather it's a thin wrapper that will include your standard library's tr1 implementation (if
It has one), otherwise it will include the boost library equivalents, and import them into namespace STD: tr1.
Tribool: 3-state Boolean Type Library.
Tuple: Define definition of functions returning multiple values, and more.
Type traits: templates for fundamental properties of types.
Typeof: typeof operator emulation.
Ublas: ublas provides matrix and vector classes as well as basic linear algebra routines. Several dense, packed and sparse storage schemes are supported.
Units: Zero-overhead dimen1_analysis and unit/quantity manipulation and conversion.
Unordered: unordered Associative containers.
Utility: Class noncopyable plus checked_delete (), checked_array_delete (), next (), prior () function templates, plus base-from-member idiom.
UUID: A universally unique identifier.
Value initialized: wrapper for uniform-syntax value initialization, based on the original idea of David Abrahams.
Variant: Safe, generic, stack-based discriminated Union iner.
Wave: the boost. Wave library is a standards conformant, and highly retriable implementation of the mandated c99/C ++ Preprocessor functionality packed behind an easy to use iterator interface.
Xpressive: regular expressions that can be written as strings or as expression templates, and which can refer to each other and themselves recursively with the power of context-free grammars.

3. Use boost
Most boost libraries areHeader-only: They consistEntirelyof header filesContaining templates and inline functions, andrequire no separately-compiled library Binaries
Or specialtreatment when linking.
The only boost libraries that must be built separately are:
Boost. filesystem
Boost. graphparallel
Boost. iostreams
Boost. MPI
Boost. programoptions
Boost. Python (see the boost. Python build documentationbefore building and installing it)
Boost. RegEx
Boost. serialization
Boost. Signals
Boost. System
Boost. Thread
Boost. Wave

A few libraries have optional separately-compiled Binaries:
Boost. datetime has a binary component that is only needed ifyou're using its to_string/from_string or serializationfeatures, or if you're re targeting visual c ++ 6.x or Borland.
Boost. graph also has a binary component that is only needed ifyou intend to parse graphviz files.
Boost. Math has binary components for the tr1 and c99cmath functions.
Boost. Random has a binary component which is only needed ifyou're using random_device.
Boost. test can be used in "header-only" or "separately compiled" mode, although separate compilation is recommended for serioususe.

4. Reference

Http://www.boost.org/

Beyond the C ++ standard library: An Introduction to boost

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.