Actions

Difference between revisions of "Boostcon 2011"

From Just in Time

Line 68: Line 68:
  
 
Creating derivative of an analytical function.
 
Creating derivative of an analytical function.
 +
 +
==Transactional Language Constructs for C++==
 +
Bridge Boost and C++ TM Spec.
 +
* tutorial
 +
* solicit feedback

Revision as of 15:11, 17 May 2011

This page will contain my notes taken during Boostcon 2011

Library in a Week

Review tools

  • Code Collaborator
  • Crucible (Crubicle?)

Notes of my 'homework' assignment are here

Sort

Radix sort, does not use comparison. Faster if compare takes a relatively long time (e.g. string). Has three functions (integer_sort, float_sort, string_sort) and three overloads for each.

boost.algorithm

Intended to be a collection of algorithms, so that review of new algorithms can be much lighter.

Boost.Asio

Chris Kohlhoff

fundamental concepts that went into the library. Use them in your programs.

One key criterium: should not be a framework, but a toolkit. This gives you more freedom.

io_service
"your channel into the operationg system"

Challenges of asynchronous programming:

  • Object lifetimes
  • Thinking asynchronously
  • Threads
  • ?

Object lifetimes

handlers and buffers are taken by value, a copy is made. Buffers are shallow.

Arguments taken by non-const reference: caller needs to guarantee lifetime. this-pointer should outlive operation. Newby problem: providing a buffer that goes out of scope (local variable for instance).

Use shared_ptr and shared_from_this to automatically manage object lifetime.

Thinking Asynchronously

Wrong:

if (socket.connected())
{   
    socket.write();
}

Threading

  • First: single threaded
  • Use other thread to handle long running task. Uset post to give the result back to the main thread. Take care to tell the service that there is still work pending while the background thread is working. use 'asio::ioservice::work.
  • multiple io_services. Tip: If you want to make handlers wait for some event triggered by another async op, use a timer that will never expire.
  • one io_service, multiple threads. Use strands.

"Difficulty with reactor pattern is that it is hard to create [higher order abstractions] based on it"

Manage Complexity

Approaches

  • Pass the buck
    • create composed operations
  • the buck stops here

"Pass the buck" refers to passing the responsibility for the lifetime of objects to the caller in a similar way that the asio-function do this.

Phoenix V3

Hartmuth Kaiser

proto

Function calls can be either done through <terminal>() or just writing a function that uses make_expr to return a proto expression(-tree). The latter has much better performance (as learned from spirit).

Creating derivative of an analytical function.

Transactional Language Constructs for C++

Bridge Boost and C++ TM Spec.

  • tutorial
  • solicit feedback