David Note: This is my note when I first studied boost. I recently saw someone asking on the Forum, So I posted it for sharing. In fact, I personally think that boost is not suitable for application development at present. After all, the boost library is too large (of course, you can only use a part, but the maintainability of the program is always a problem ), u
Simple startThe Chinese interpretation of serialization is "serializing", "serialization", or "persistence", which means to save the objects in the memory to the disk, when the program runs again, it reads the files on the disk and restores the original objects. The following is a simple example: # include # Include
# Include Class A {PRIVATE ://
To enable the serialized class library to access private members, declare a friend class.
Friend class boost
Now let's carefully analyze the class cconnect, which is mainly used to manage a connection transaction, such as data receiving and sending. Therefore, cconnect must have a network socket Member, which uses the boost: ASIO: IP: TCP: Socket class, this class receives network data asynchronously or synchronously. In this example, the async_read_some function of the boost: ASIO: IP: TCP: Socket class is called
mentioned above. I can pass the reference and change the internal state of my reader, but the compiler is a bit unhappy, it will warning because you are a const statement and you have removed its const ....
The C ++ standard encourages us to do this. The for_each and Other interfaces are all written by passing values... If you use those interfaces, you cannot upload references?
Solve all the problems with boost: ref and kaka.
Template
Note that the
Read the source code for the no lock queue in the Boost library on the network, but it lacks the compilation method. After testing, the method of compiling the boost library in Ubuntu 14.04 was determined and recorded.Lock-Free (Free-lock) is an important technique for high-performance multithreaded concurrent programming.As the C++11 STL reference implementation of the
Boost official website http://www.boost.org/
Boost SourceForge http://sourceforge.net/projects/boost/files/
ASIO official website http://think-async.com/
ASIO sourceforge http://sourceforge.net/projects/asio/files/
ASIO samples Https://github.com/mabrarov/asio_samples
1. Go to the official website www.boost.org Download the latest
Now to carefully analyze the class cconnect, its main function is to manage a connected transaction, such as data receiving and sending. Therefore, the class CConnect must have a network socket member, it is to use the Boost::asio::ip::tcp::socket class, this class mainly to achieve asynchronous or synchronous way to receive data network data. In this example, invoking the Async_read_some function of the Boost
Learn the Open Source Library The first step is to compile and install the library, and then run a successful demo before you can do the work.Let's talk about the installation of the Boost library under Linux. [email protected] ~]$ TAR-ZXVF boost_1_55_0.tar.gz[Email protected] boost_1_55_0]$. /bootstrap.sh--prefix=/home/mjf/lib[Email protected] boost_1_55_0]$ sudo./b2 Install 1. Unzip2. Generate BjamThe above command can be provided with various opti
Compiling the installationcompile Bjam: use the command below to create boost's own build tool Bjam (to ensure that boost is compiled with Bjam on any platform), similar to GNU make../bootstrap.sh./bootstrap.sh--prefix=/home/usrname/boost_1_43_0/boost_installBoost will be installed in the/boost_install directory, and the unknown prefix will be installed by default to/usr/local/include and/usr/local/lib../bjam--helpThe. Bjam command is in the format: b
> 0
Return:
First element
Thrown:
Do not throw an exception
4.reference back ();Const_reference back () const;
Requirements:
N > 0
Return:
Last element
Thrown:
Do not throw an exception
5.const t* data () const;
Return:
elems
Thrown:
Do not throw an exception
6.t* C_array ();
Return:
elems
Th
Boost reads XML file
Boost provides support for configuration file reads: Property_tree.
Basic_ptree is the core foundation of Property_tree. Its interface is like Std::list. You can perform a number of basic element operations, such as using begin (), End (), and so on.Additional operations such as Get (), Get_child (), Get_value (), data () of the operation attribute tree are also added.
Basic_ptree ha
(i) The date and time of the boost libraryFirst, the timerTimers, it is often useful to count the execution time of a function in a project.#include voidprintusertime() { Boost::timer T; //Define a timing class to start timing std::" maximum measurable time:" "hstd::endl; std::" maximum time measurable:"sstd::endl; std::" use time:" Std::endl; }Second, get the current dateD (day_cloc
0. PrerequisitesBoost Library version 1.57.0http://www.boost.org/users/history/version_1_57_0.html, select Windows EditionCompiler: VS2010Compile target: Static link libraryC + + Runtime link mode:/MT/MTD/MD/MDDThe Windows platform compiler tests given on the website includeWindows:GCC, mingw:4.4.0, 4.4.7. 4.5.4, 4.6.3, 4.7.2, 4.7.3, 4.8.0, 4.8.2, 4.9.0Visual C + +: 8.0, 9.0, 10.0, 11.0, 12.0Compile step1. Enter the boost Coogan directory via the VS20
Looking at the information of the Boost.asio Library of the day, it is still a little confused. For ASIO's study to continue, at the same time here also recorded the first small example of their own start. It feels better to start with a small example and then to understand what those principles are. Because the conceptual principle is too abstract, with a small example to know how to be a routine. For the ASIO library in the later study will continue to write some articles to record some notes.
Author: Unknown Source: Internet ithao123Abstract: The IT personnel boost library is a C ++ library that has been thoroughly tested, transplanted, and provided source code. As a backup for the standard library, it is one of the engines of the C ++ standardization process. The boost library was initiated by members of the C ++ Standards Committee working group. It has a significant impact in the C ++ communi
Bind-boost
Header file: boost/Bind. HPP
BIND is a set of overloaded function templates.Used to bind certain parameters to a function (or function object.The return value of BIND is a function object.
Its source file is too long. You can't see it. Here we only write down its usage:
9.1 for common functions
Assume that the function fun () is as follows:Void fun (int x, int y ){Cout }Now let's look at how to b
In the Linux GCC environment, boost does not add the-FPIC parameter during compilation. As a result, if a shared library uses the boost static library, the following error is reported:Relocation r_x86_64_32 against 'a local symbol' can not be used when making a shared object; recompile with-FPICIf automake is used for compilation, you can use cppflags to add-FPIC.For boost_000053_0, modify tools/build/v2/to
Boost includes five strings and libraries in the text processing field:[1] Two lexical_cast and format functions are similar to the functions of the C standard library. They focus on the representation of strings and can convert values into strings to precisely format the output.[2] The string_algo Library provides a large number of commonly used string processing functions.[3] tokenizer and xpressive, the former is a word divider, the latter is a fle
Environment: Ubuntu 12.04 32bit, boost 1.49
Preparations: other function libraries are used in boost. To use the functions in boost, you must first install the libraries that may be missing in the system.
Apt-get install mpi-default-dev # install the mpi Library
Apt-get install libicu-dev # UNICODE Character Set supporting regular expressions
Apt-get install pyth
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.