From 3a8b2647e13d3ecfc031c95ddeb23247da9b62fb Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 15 Jan 2025 20:37:23 -0800 Subject: [PATCH] update the documentation regarding STL usage --- CODE_STYLE.md | 16 ++++++++++++++-- filament/backend/include/backend/DriverEnums.h | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index 0a1e7857268..7c394c2dc19 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -121,9 +121,21 @@ private: - other headers are sorted in reverse order of their layering, that is, lower layer headers last - within a layer, headers are sorted alphabetically - strive for implementing one class per file -- `STL` limited in public headers to: - - `type_traits` +- `STL` limited in **filament** public headers to: + - `array` + - `initializer_list` + - `iterator` - `limits` + - `optional` + - `type_traits` + - `utility` + - `variant` + +For **libfilament** the rule of thumb is that STL headers that don't generate code are allowed (e.g. `type_traits`), +conversely containers and algorithms are not allowed. There are exceptions such as `array`. See above for the full list. +- The following `STL` headers a banned entirely, from public and private headers as well as implementation files: + - `iostream` + *Sorting the headers is important to help catching missing `#include` directives.* diff --git a/filament/backend/include/backend/DriverEnums.h b/filament/backend/include/backend/DriverEnums.h index 358c5420260..48de51c63ff 100644 --- a/filament/backend/include/backend/DriverEnums.h +++ b/filament/backend/include/backend/DriverEnums.h @@ -33,9 +33,9 @@ #include -#include // FIXME: STL headers are not allowed in public headers -#include // FIXME: STL headers are not allowed in public headers -#include // FIXME: STL headers are not allowed in public headers +#include +#include +#include #include #include