C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
Implicit Type Conversions

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 "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"); ~~