Category : abseil

I tried to use abseil’s string library, but already the simple example does not run and fails with terminate called after throwing an instance of ‘std::bad_alloc’. The snippet I use #include "absl/strings/str_cat.h" #include "fmt/core.h" int main(){ auto s1 = absl::StrCat("A string ", " another string", "yet another string"); fmt::print( "{}n", s1); } I use Abseil ..

Read more

i use google test and google mock. There is a mock object on which i expect a method call OnConnectionError() which notifies the absl::Notification object done 3 times. absl::Notification done; EXPECT_CALL(*client, OnConnectionError(::testing::_)).Times(3) .WillRepeatedly(Notify(&done)); bool result = client->ConnectToServer("localhost", 5000, 2); done.WaitForNotificationWithTimeout(absl::Duration(absl::Seconds(30))); The method client->ConnectToServer has a loop which results in the repetitive call of OnConnectionError, which ..

Read more

The pattern from <random> is the standard design for a modern C++ approach to sample from univariate distributions, which is also adapted in Boost-Random and abseil. Major benefits of this pattern seem to be Orthogonal implementation of the distribution and the uniform random bit generator. Standardized layout shared by all distribution. Is there a library ..

Read more

I’m trying to use some functions from ABSEIL random with Cmake. (like absl::Uniform()) I made all like in this instruction. And all work. Then i want more and started to test absl::Uniform(). ABSEIL RANDOM My hello_word.cc is like #include <iostream> #include <string> #include <vector> #include "absl/strings/str_join.h" #include "absl/random/random.h" int main() { std::vector<std::string> v = {"foo","bar","baz"}; ..

Read more

I’m trying to create a absl::flat_hash_set of folly::small_vector. The documentation for adding support for a custom type for absl::Hash says: An AbslHashValue overload for a type should only be declared in the same file and namespace as said type. The proper AbslHashValue implementation for a given type will be discovered via ADL. Unfortunately I can’t ..

Read more