Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asio without Boost

Is Asio still developed separate from Boost, or is Boost.Asio the only version still being updated?

On the Asio website they talk about there being benefits to both versions, and that Asio is updated more often than Boost is. However, the latest dev release on the site is 1.5.3, released in March of 2011, whereas the latest Boost 1.53 release from February 2013 includes Asio 1.8.3, with a large number of changes since 1.5.3.

Either the Asio website was abandoned without notification in favor of Boost-only updates, or it has moved to some location I haven't found. Does anyone know definitively what happened?

The reason I ask is that I'm trying to cut Boost from my project, and Boost.Asio is the only Boost library I'm currently using. Asio by itself is a header-only library, but Boost.Asio pulls in several other Boost libraries (System, Regex, Date_Time) which are otherwise unused.

I'd be willing to switch to another light-weight socket library, but haven't found one as good as Asio yet (in terms of low dependencies and using native platform iocp/epoll methods).

like image 418
Nairou Avatar asked Apr 18 '13 12:04

Nairou


2 Answers

Asio is separately developed, then boostified and merged into Boost.Asio. However, you may not be able to remove Boost from your project based on which features and compiler are being used. As of Asio 1.10.0, Asio tries to use the equivalent C++11 standard libraries instead of Boost.

Asio is basically Boost.Asio:

  • Without the Boost namespace and macro naming conventions.
  • Not dependent on Boost.System and Boost.Thread as Asio provides its own limited functionality in place of these two libraries.

Boost dependencies may exists for Asio versions before 1.10.0. These dependencies are often introduced within templates; thus, the dependency may only occur when an application uses specific functionality. It is easy to overlook the subtle detail on the Asio and Boost.Asio page, where it states:

Asio is header-file-only and for most uses does not require linking against any Boost library. When using C++11 with recent versions of gcc, clang or MSVC, Asio can be used independently of Boost by defining ASIO_STANDALONE when you compile.

In general, the following features introduce dependencies:

  • Timers depend on Boost.DateTime or Boost.Chrono. For Asio 1.10.0 and beyond, C++11 builds will use std::chrono will be used.
  • read_until() operations that use regex depend on Boost.Regex.
  • Stackful coroutines that are based on the Boost.Coroutine library.

It may be worth considering using:

  • BCP to extract the subset of Boost libraries your project needs.
  • libuv, a C library that provides an asynchronous event-loop and abstraction from the native I/O event notification. This answer compares the two libraries.
like image 96
Tanner Sansbury Avatar answered Oct 10 '22 08:10

Tanner Sansbury


I asked via e-mail where the non-boost version is maintained and Christopher Kohlhoff, the author, said he maintains it on github

https://github.com/chriskohlhoff/asio

Looking at it today it doesn't seem like 1.8.3 is up there, or at least it's not been labeled so it could be that he stopped maintaining that repo.

like image 25
sputnik13 Avatar answered Oct 10 '22 09:10

sputnik13