|
1 | 1 | #pragma once |
2 | 2 |
|
3 | | -// TODO: explain |
| 3 | +// One of the clients of this library is Envoy, a service (HTTP) proxy. |
| 4 | +// |
| 5 | +// Envoy uses Abseil as its base C++ library, and additionally builds in C++17 |
| 6 | +// mode. Abseil has a build option to forward its `std::string_view` and |
| 7 | +// `std::optional` equivalents to the actual standard types when C++17 is |
| 8 | +// available. |
| 9 | +// |
| 10 | +// Envoy does not use this Abseil build option, due to incomplete support for |
| 11 | +// the C++17 standard library on iOS 11. |
| 12 | +// |
| 13 | +// As a result, Envoy forbids use of `std::string_view` and `std::optional`, |
| 14 | +// instead preferring Abseil's `absl::string_view` and `absl::optional`. |
| 15 | +// |
| 16 | +// This presents a problem for this library, since we use `std::string_view` |
| 17 | +// and `std::optional` in the exported interface, i.e. in header files. |
| 18 | +// |
| 19 | +// As a workaround, Bazel (the build tool used by Envoy) builds of this library |
| 20 | +// will define the `DD_USE_ABSEIL_FOR_ENVOY` preprocessor macro. When this |
| 21 | +// macro is defined, the library-specific `StringView` and `Optional` aliases |
| 22 | +// will refer to the Abseil types. When the macro is not defined, the |
| 23 | +// library-specific aliases will refer to the standard types. |
| 24 | +// |
| 25 | +// This file defines `datadog::tracing::Optional`, a type template that is an |
| 26 | +// alias for either `std::optional` or `absl::optional`. |
4 | 27 |
|
5 | 28 | #ifdef DD_USE_ABSEIL_FOR_ENVOY |
6 | 29 | // Abseil examples, including usage in Envoy, include Abseil headers in quoted |
|
0 commit comments