C++ evaluates comma-separated expressions from left-to-right, using only the last element as return type of the whole expression. This means that message handlers and behaviors must not be initialized like this:

message_handlerwrong=([](inti){/*...*/},[](floatf){/*...*/});

The correct way to initialize message handlers and behaviors is to either use the constructor or the member function assign:

message_handlerok1{[](inti){/*...*/},[](floatf){/*...*/}};message_handlerok2;// some place laterok2.assign([](inti){/*...*/},[](floatf){/*...*/});

The member function become does not block, i.e., always returns immediately. Thus, lambda expressions should always capture by value. Otherwise, all references on the stack will cause undefined behavior if the lambda expression is executed.

It is strongly recommended to not share states between actors. In particular, no actor shall ever access member variables or member functions of another actor. Accessing shared memory segments concurrently can cause undefined behavior that is incredibly hard to find and debug. However, sharing data between actors is fine, as long as the data is immutable and its lifetime is guaranteed to outlive all actors. The simplest way to meet the lifetime guarantee is by storing the data in smart pointers such as std::shared_ptr. Nevertheless, the recommended way of sharing informations is message passing. Sending the same message to multiple actors does not result in copying the data several times.