[RFC,v3,03/22] libcamera: base: Add file for C++20 polyfills
diff mbox series

Message ID 20251030165816.1095180-4-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: Add `MetadataList`
Related show

Commit Message

Barnabás Pőcze Oct. 30, 2025, 4:57 p.m. UTC
Add `cxx20.h` that will contain (possibly limited) C++17 implementations
of some C++20 standard library features.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 include/libcamera/base/internal/cxx20.h | 18 ++++++++++++++++++
 include/libcamera/base/meson.build      |  7 +++++++
 2 files changed, 25 insertions(+)
 create mode 100644 include/libcamera/base/internal/cxx20.h

Comments

Kieran Bingham Oct. 31, 2025, 8:51 a.m. UTC | #1
Quoting Barnabás Pőcze (2025-10-30 16:57:57)
> Add `cxx20.h` that will contain (possibly limited) C++17 implementations
> of some C++20 standard library features.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  include/libcamera/base/internal/cxx20.h | 18 ++++++++++++++++++
>  include/libcamera/base/meson.build      |  7 +++++++
>  2 files changed, 25 insertions(+)
>  create mode 100644 include/libcamera/base/internal/cxx20.h
> 
> diff --git a/include/libcamera/base/internal/cxx20.h b/include/libcamera/base/internal/cxx20.h
> new file mode 100644
> index 0000000000..70a43f83c9
> --- /dev/null
> +++ b/include/libcamera/base/internal/cxx20.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> +/*
> + * Copyright (C) 2025, Ideas on Board Oy
> + *
> + * C++20 polyfills
> + */
> +
> +#pragma once
> +
> +/**
> + * \internal
> + * \file cxx20.h
> + * \brief C++17 implementations of certain C++20 types and functions
> + */
> +
> +namespace libcamera::internal::cxx20 {
> +
> +} /* namespace libcamera::internal::cxx20 */
> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
> index f28ae4d42a..ee42c9910f 100644
> --- a/include/libcamera/base/meson.build
> +++ b/include/libcamera/base/meson.build
> @@ -31,10 +31,17 @@ libcamera_base_private_headers = files([
>      'utils.h',
>  ])
>  
> +libcamera_base_internal_headers = files([
> +    'internal/cxx20.h',
> +])
> +
>  libcamera_base_headers = [
>      libcamera_base_public_headers,
>      libcamera_base_private_headers,
> +    libcamera_base_internal_headers,
>  ]
>  
>  install_headers(libcamera_base_public_headers,
>                  subdir : libcamera_base_include_dir)
> +install_headers(libcamera_base_internal_headers,
> +                subdir : libcamera_base_include_dir / 'internal')

Eeep ok - so we have to install the internal polyfils on public-api
space.

I think I can predict why this is going to be needed, so I'll add this:

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

I'll be curious if we can do anything like we do for
include/libcamera/base/private.h but I suspect not if this file is going
to be directly included in public headers.



> -- 
> 2.51.1
>

Patch
diff mbox series

diff --git a/include/libcamera/base/internal/cxx20.h b/include/libcamera/base/internal/cxx20.h
new file mode 100644
index 0000000000..70a43f83c9
--- /dev/null
+++ b/include/libcamera/base/internal/cxx20.h
@@ -0,0 +1,18 @@ 
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2025, Ideas on Board Oy
+ *
+ * C++20 polyfills
+ */
+
+#pragma once
+
+/**
+ * \internal
+ * \file cxx20.h
+ * \brief C++17 implementations of certain C++20 types and functions
+ */
+
+namespace libcamera::internal::cxx20 {
+
+} /* namespace libcamera::internal::cxx20 */
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
index f28ae4d42a..ee42c9910f 100644
--- a/include/libcamera/base/meson.build
+++ b/include/libcamera/base/meson.build
@@ -31,10 +31,17 @@  libcamera_base_private_headers = files([
     'utils.h',
 ])
 
+libcamera_base_internal_headers = files([
+    'internal/cxx20.h',
+])
+
 libcamera_base_headers = [
     libcamera_base_public_headers,
     libcamera_base_private_headers,
+    libcamera_base_internal_headers,
 ]
 
 install_headers(libcamera_base_public_headers,
                 subdir : libcamera_base_include_dir)
+install_headers(libcamera_base_internal_headers,
+                subdir : libcamera_base_include_dir / 'internal')