I'm using VC8.0 and Boost_1_35_0. It's okay to recompile boost yourself, but I use the
Http://www.boostpro.com/products/free
The installation tool provided Boostpro 1.35.0 Installer (192K. exe). I strongly recommend using this tool to install the Boost library and source files under Windows.
1 Use the Boost_1_35_0_setup.exe tool to download the Boost library,
Object-Oriented programming style Object-based programming (boost: bind/function)"Muduo is a modern C ++ network library. There are two differences between APIs in modern and ancient times. One is Event Callback, and the other is resource management. An API is designed for a network library to define an interface (abstract base class) that contains the processing functions corresponding to several network events. Your code inherits this interface, wh
Synchronize Timer
The timer name provided in asio is deadline_timer, which provides the time-out function. First, we will use the simplest Timer synchronization method as an example to demonstrate how to use it.
# Include# IncludeInt main (){Boost: asio: io_serviceIo;Boost: asio: deadline_timerTimer (io, boost: posix_time: seconds (3 ));Timer. wait ();Std: cout
Boost::any can store any type of C + + type, or it can be a user-defined type. Very convenient, can be very convenient to determine the type of data in the process of operation, so as to carry out related operations.Function Prototypes://In header: classAny { Public: //construct/copy/destructany (); Any (ConstAny ); TemplateConstValueType ); anyoperator=(ConstAny ); Templateoperator=(ConstValueType ); ~any (); //modifiersAny Swap (any ); //Queries
I have done a lot of boost log examples, now To sum up, the latest code in my open source project: https://gitlab.com/mystudy/boost_log
The architecture diagram of the boost log library is as follows:
The following summarizes the knowledge related to this architecture:1. How to obtain the Logging core
#include
2. How to install the Sink object
Multiple sinks can be installed on one core. The following C
Further encapsulation of boost: shared_from_this,Further encapsulation of boost: shared_from_this
Those familiar with asynchronous programming may be familiar with boost: shared_from_this. When we pass in the callback, we usually want it to carry the context of the current class object, or the callback itself is a class member function, then this job is naturally
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
From http://cunsh.ycool.com/post.1946109.html
Chapter 2 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:V
A synthesizer is a class that overload the operator () operator. This operator is automatically called, and two iterators are passed in to point to all the returned values of a specific signal. The above example uses the Standard C ++ algorithm STD: min_element () to determine and return the smallest value.
Unfortunately, we cannot pass an algorithm like STD: min_element () directly to boost: signal as a template parameter.
Boost is called the quasi-Standard C ++ library, but this is also the title of this community. In other words, boost is really powerful. However, general companies do not use it. The reason is: it is not a C ++ standard. I have met many times for this reason. Many people do not know whether to understand boost or deliberately degrade it. Always have a negative at
Recently I want to create a logstore. I used log4cplus before. I saw a logstore started after boost launched version 1.54. After reading this log, I started to use it. The main application scenario is to use multiple modules (So, DLL. The scenario is a program with multiple modules. The module is a separate so. The printed logs are output to the same file.
Initially, the compiled boost library is a static
Cmake-boost
Last update date:2014-04-25by kagula
Prerequisites: Introduction to cmake (II) and basic Linux operations
Environment:Windows 8.1 64bit English version, Visual Studio 203 update1 English version, cmake 2.8.12.2, cent OS 6.5, cent OS 6.5 comes with GCC 4.4.7, ICU 4.2.1
Introduction
This section describes how to use the cmake tool to move projects on cent OS if projects on Visual Studio depend on the bo
Part 1: vs2010 + boost:
(1) download and install the boost Library
: Http://www.boost.org/
Install to a specified directory, for example:
E: \ boost_000051
(2) Use the boost library in vs2010
Configure the boost Library
Configure the include path
boost parsing JSON-formatted textFlyfish 2015-4-1Property_tree can parse text in Ini,xml,json,info and other formatsThe following example is parsing text in JSON formatheader files that need to be included#include Generate Datavoid Generate_user () {boost::p Roperty_tree::p tree root; Boost::p roperty_tree::p tree items;boost
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.