Boost::d Eadline_timerDefinedtypedef basic_deadline_timerBasic_deadline_timer is a template class.constructor functionDeadline_timer has three constructors:1 Explicit Basic_deadline_timer (boost::asio::io_service io_service): Basic_io_object{}The constructor has a parameter io_service, and almost all ASIO programs use Io_service (this class is later learned). This oneThe constructor creates a timer with no
4.6 use third-party LibrariesThe preceding section describes how to assign values to, convert, and convert character codes to Visual C ++. In fact, there are some useful third-party class libraries to help C ++ programmers complete object processing, boost is a famous one. This section briefly introduces boost: any, boost: lexical_cast, and rational
Install the boost library in our c ++ project. The following uses vs2010 as an example. The settings for other versions are similar.
1. compile and generate a boost Library
1. download the latest boost (I downloaded boost_42456_0 ). Boost official website (www.boost.org ).
2. decompress the
Although boost: mutex provides the lock and try_lock methods, boost: timed_mutex only supports timed_lock, which is the reason why the above example is used. If timed_lock is not required, boost: mutex can be used as in the previous example.
Like boost: lock_guard, the boost
(iv) The regular expression of the boost library regexThe regular expression can bring us great convenience, with it, no longer have to worry about thisHeader file:#include 1. Exact match std::stringstr("ABCD"); Boost::reg("A\\w*d"); if (Regex_match (str, REG)) { std::"is matchStd::endl; } Else { STD:: "is not matchStd::endl; }2. Exactly match and get substring
C + + has a powerful boost, and there are a lot of features that are not supported by the C + + standard library. Look at the boost of those powerful functional templates how can not be tempted! Let's take a look at how to use the Boost library under VS2010.System: Windows7Development environment: Visual Studio 10Boost version: Boost_1_55_0(1)
In boost. Python, python is embedded in the C ++ section, and Chinese documents found on the Internet seem to be outdated,
Such as boost. Python Study Notes http://edyfox.codecarver.org/html/boost_python.html
InBoost. Python version 2To provide more concise and easy-to-use interfaces.
Replace the originalPython c Conversion API, such as pyrun_simplestring.
There are actually two parts about Pytho
Boost smart pointer -- scoped_ptr
Source: http://www.cnblogs.com/TianFang/archive/2008/09/15/1291050.html
Boost: scoped_ptrAndSTD: auto_ptrSimilarly, it is a simple smart pointer that can ensure that the object is automatically released after it leaves the scope. BelowCodeDemonstrate the basic application of the pointer:
# Include # Include # Include ClassImplementation{Public:~ Im
From:http://greyforest.blog.sohu.com/152084205.html
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. I can't see it anymore. Here is only a note of its usage:
9.1 For ordinary functions
If there is a function fun () as follows:voi
catch all possible exceptions. To ensure that the memory is freed before the exception is passed to the caller of the function. The smart pointer series of the Boost C + + library provides a number of smart pointers that can be used in a variety of situations.RAIIRAII full name is "Resource acquisition is initialization", literal translation is "resource acquisition is initialization".But this translation does not show the true meaning of this habitu
Address: http://hi.baidu.com/hardcorn/blog/item/c8cb1b17284fe7074b90a76f.html
Compile boost on the Win32 system. We use WINXP as an example:
Boost contains a tool similar to make/nmake: bjam, which is the compilation method recommended by boost,We use bjam to compile boost, and the source code of bjam is also inclu
I recently used multi-thread programming in message-oriented middleware. I used the boost thread library for cross-platform reasons. Several ways to create a thread are summarized as follows:
Let's take a look at the boost: thread constructor. Boost: thread has two constructor functions:(1) thread (): constructs a thread object that represents the current execut
Recently I used the boost: math Library and found that it would conflict with my previous programs. For example, if my program uses
# Include
Google, the reason is that boost: tr1 was designed to allow you to still use std :: tr1: unordered_map, std: tr1: tuple, etc. Of course, this is a work around und, that is, you actually still use boost: tuple, etc.
You can
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
overloading. The original version returns the null non_scalar_ptr object. The two versions of copy_opt are as follows:
TemplateIterOut copy (IterIn first, IterIn last, IterOut dest, scalar_ptr) {...} // use memmovetemplateIterOut? Copy (IterIn? First, IterIn last, IterOut dest, non_scalar_ptr) {...} // step by step copy
In fact, allocation is usually required to improve efficiency.
3. enable some code to be compiled
This may be confusing. Can I compile the code without the help of traits? Yes.
The boost. Assert library enhances the original assert Macro during runtime. The static_assert Library provides static assertions (diagnosis during compilation), while the boost. Test Library builds a complete unit test framework.
Assert:The idea tool provided by boost. Assert is the boost_assert macro, which is similar to the assert macro in the C standard and p
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.