Boost is a quasi-standard library, which is equivalent to the continuation and expansion of STL. Its Design Concept is similar to that of STL, and it uses generics to maximize reuse. However, boost is more practical than STL. STL is concentrated in the algorithm part, while boost contains many tool classes to complete specific work.
Boost mainly includes several categories: string and text processing, containers, and Iterator) algorithm, function object and high-level programming, generic programming, template meta-programming, preprocessing meta-programming, concurrent programming, Mathematical Correlation, error correction and testing, data structure, input/output, cross-language supported, memory-related, syntax analysis, and miscellaneous. Some libraries are cross-category, that is, they belong to both this category and that category.
In the Text Processing Section, the conversion/lexcial_cast class is used to convert numbers and strings using the C ++ method. It is mainly used to replace functions such as atoi and itoa in the C standard library. Of course, one of the biggest advantages is that it supports generics.
The format Library provides the "printf-like" function for streaming. In printf, the replacement method using parameters such as % d and % s is very convenient in many cases, while STL iostream lacks such a function. Format adds this function for stream and is more powerful than the original printf.
Regex, This is not much to mention, the regular expression library. If you need to perform string analysis, you will understand how useful regular expressions are.
Spirit: This is the LL analysis framework. files can be analyzed according to EBNF rules. (Do not tell me what EBNF is ). Compiler may be used. It is not widely used by ordinary people.
Tokenizer library. I used to see on CSDN how to split a string into a string array by commas. Some may envy VB's split function. Now, the boost tokenizer has the same function. If I remember correctly, this tokenizer also supports regular expressions. Isn't it nice?
Array.
Dynamic_bitset: dynamically allocates bitsets of the size. We know that there is a bitset in STL, which provides a lot of convenience for bit operations. Unfortunately, the size must be specified during the compilation period. Now, the bitset with dynamic size allocation is available at runtime.
Graph. Provides the image container and Related algorithms. I have not used a graph in the program. You can check it if you need it.
Multi_array provides multi-dimensional array encapsulation, which should be useful.
In concurrent programming, there is only one library, thread, which provides a portable thread library, but it is of little use on Windows platforms. It is based on Posix Threads and does not support Posix well in Windows.
The following mathematical and numerical classes contain many class libraries for numerical processing. I am not familiar with mathematics. However, there are several classes that are useful, such as the rational score class, random number, and so on.
Static_assert, which provides the assert function of the compiler.
Test Library, a unit test framework, very good.
Concept_check provides a slightly improved check on the number of generics during generic programming, but it is better than not.
Data Type class any, a secure class that can contain different objects. Using it as the element type of the container, the container can contain different types of elements. It is safer than void.
Compressed_pair is similar to pair in STL. However, empty elements are optimized.
Tuple. Allows the function to return multiple values.
Cross-language support: python. Here are some Chinese documents about boost. python on CSDN: http://dev.csdn.net/article/19/19828.shtm,http: // assets/19830. shtm, http://dev.csdn.net/article/19/19831.shtm
Pool: memory pool. You don't have to worry about frequent memory allocation and release, resulting in memory fragments. You don't have to work hard on your own.
Smart_ptr: smart pointer. You don't have to worry about memory leakage. However, the smart pointers in C ++ are not perfect, so be careful when using them.
Date_time, Which is platform-independent and class library-independent. If the program needs to be cross-platform, consider using this.
Timer provides a timer. Although it is not a message-based timer in Windows, it is said that it can be used to measure the statement execution time.
Uitlity provides a noncopyable class to implement a class that cannot be copied. In many cases, we need to avoid copying a class, such as a class that represents a file handle. If the file handle is shared by two instances, there will be a lot of problems in the operation, and the semantics cannot be said. Generally, the method to avoid instance replication is to privatize the copy structure and operator =. Now we only need to inherit this class, which is much clearer.
Value_initialized: Initialize the value to ensure that all declared objects are initialized explicitly. Is this practical? It seems that writing this is more exhausting than writing initialization directly. Oh, the benevolent sees benevolence.
In addition to regex, python, and test, most of them can be directly used in source code, which is more convenient. In fact, it is not difficult to use these libraries. The main reason is that some libraries require background knowledge, such as metaprogramming, STL, and generic programming.
Author: xuhongwei0411