libcaf  0.15.3
Implicit Type Conversions

The message passing of libcaf prohibits pointers in messages because it enforces network transparent messaging. More...

The message passing of libcaf prohibits pointers in messages because it enforces network transparent messaging.

Unfortunately, string literals in C++ have the type const char*, resp.const char[]. Since libcaf is a user-friendly library, it silently converts string literals and C-strings to std::string objects. It also converts unicode literals to the corresponding STL container.

A few examples: ~~ // sends an std::string containing "hello actor!" to itself send(self, "hello actor!");

const char* cstring = "cstring"; // sends an std::string containing "cstring" to itself send(self, cstring);

// sends an std::u16string containing the UTF16 string "hello unicode world!" send(self, u"hello unicode world!");

// x has the type caf::tuple<std::string, std::string> auto x = make_message("hello", "tuple");

receive ( // equal to: on(std::string("hello actor!")) on("hello actor!") >> [] { } ); ~~