[Class 12] Google Open Sources Abseil, a Collection of C++ and Python Utilities
Google has made available a number of C++ libraries they use internally for many of their projects. Python ones are to follow soon.
Google has developed Abseil over a decade in order to support the needs of their programmers working on various projects including Protocol Buffers, gRPC, or TensorFlow. Google even says that Abseil is:
a collection of libraries drawn from the most fundamental pieces of Google’s internal codebase. These libraries are the nuts-and-bolts that underpin almost everything that Google runs. Bits and pieces of these APIs are embedded in most of our open source projects, and now we have brought them together into one comprehensive project.Abseil encompasses the most basic building blocks of Google’s codebase: code that is production tested and will be fully maintained for years to come.
Abseil includes abstractions that initially were not part of C++14 or C++17, but some of them ended up being included in the standard. For example, Google had a type called
StringPiece.
Later, C++ 17 added a similar type called std::string_view
, and Google has reworked StringPiece
into absl::string_view
to have the same API as the newly C++ 17 type. Under the hood, Abseil’s string_view defaults to the standard implementation if the developer is using C++ 17 or to Google’s implementation if using a previous C++ version.
The benefit of using Abseil is having access to C++ features not existing in the standard yet, with the promise that Google will rework them to default to the standard when included in it. Google encourages developers to adopt Abseil, mentioning that they have over 250M lines of C++ code that uses it and almost every project builds from the head. That means Abseil is very used by Google and constantly maintained to keep up with the needs of their projects.
Abseil includes the following libraries:
base
- initialization and other basic code.algorithm
- additions to the C++<algorithm>
library and container-based versions of such algorithms.container
- additional STL-style containers.debugging
– debugging library used to check for leaks.memory
– includes C++11-compatible versions ofstd::make_unique()
and memory management.meta
– includes C++11-compatible versions of type checks available within C++14 and C++17 versions of the C++<type_traits>
library.numeric
- C++11-compatible 128-bit integers.strings
– various string utilities.synchronization
- concurrency primitives and synchronization abstractions.time
- abstractions for working with absolute points in time, time durations, and time zones.types
- non-container utility types.
Join the conversation