[libcxx-commits] [libcxx] [libc++] Add container_traits (prework for `std::flat_map`) (PR #109578)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 27 10:36:31 PDT 2024


================
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef _LIBCPP___TYPE_TRAITS_CONTAINER_TRAITS_H
+#define _LIBCPP___TYPE_TRAITS_CONTAINER_TRAITS_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp>
+struct __container_traits {
+  using __emplacement_has_strong_exception_safety_guarantee = false_type;
----------------
ldionne wrote:

I think you could do `static _LIBCPP_CONSTEXPR bool __emplacement_has_strong_exception_safety_guarantee = false` so it works in C++03 as well. `_LIBCPP_CONSTEXPR` will expand to `const` then.

https://github.com/llvm/llvm-project/pull/109578


More information about the libcxx-commits mailing list