Asio与Boost.Asio

Translated from http://think-async.com/Asio/AsioAndBoostAsio

There are two variations Asio non :( the Boost) and Asio Boost.Asio. SUMMARY difference between the two described herein.

1. The difference in source code

  • Asio located asio :: namespace, rather Boost.Asio is located in boost :: asio ::.

  • Asio main header file is asio.hpp, and Boost.Asio is a boost / asio.hpp, all other headers made similar changes.

  • Asio use or macros defined prefix ASIO_, while the prefix is ​​Boost.Asio macro BOOST_ASIO_.

  • Class asio :: thread Asio contain start thread, Boost.Asio do not have this class, so as not to overlap with the Boost.Thread library function.

  • Boost.Asio use Boost.System error code library provides support (boost :: system :: error_code and boost :: system :: system_error), Asio will include it in their own namespace (asio :: error_code and asio :: system_error). Boost.System current versions of these classes are better able to support user-defined error code.

  • Asio header only, in most cases does not require any link Boost library, Boost.Asio always ask Boost.System link library, if you want to use boost :: thread start threads, but also to link Boost.Thread library.

2. Obtain release package from where?

Asio can be downloaded from SourceForge, packages are asio-XYZtar.gz (or .tar.bz2, or .zip).

Boost.Asio Boost 1.35 is included in the release version. Can be downloaded from SourceForge named boost_asio_X_Y_Z.tar.gz a separate package. You should copy the downloaded package to the existing Boost source code release.

3. Where is the source code library?

Asio use in the CVS repository sourcforge. Details on how to access the CVS repository see here, the warehouse can also browse the Web.

Boost.Asio SVN source code repository in the Boost.

4. How the two versions is maintained?

All Asio development are carried out in the CVS repository. Source code is periodically converted into the format by boostify.pl Boost script, then the changes incorporated into the Boost SVN repository.

5. Now Boost already contains Boost.Asio, Asio will no longer update it?

No, using Asio the project will be continued support.

6. Asio should be used or Boost.Asio?

It depends on various considerations:

  • If you choose only the convenience of header files, it is recommended to use Asio, instead Boost.Asio.

  • Boost does not contain Boost.Asio before If you must use version 1.35, you can copy Boost.Asio to Boost release version, but some people may not be used to do so. If so, I recommend using Asio, instead Boost.Asio.

  • The new version Asio and Boost.Asio release cycle is shorter than Boost. If you want to use the latest features, just copy the Boost.Asio to Boost release version on it. If you do not want to do that, it wants to use Asio.

7. Asio and Boost.Asio can coexist in a program it?

can. Although the type itself is clearly not interchangeable, but both use a different namespace, should not have a conflict. (If you want to know why the need to do so, consider using third-party libraries under the program, while the use of third-party libraries Asio inside)

Guess you like

Origin www.cnblogs.com/kolane/p/12071089.html