================ @@ -0,0 +1,113 @@ +// -*- 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_EMBED +#define _LIBCPP_EMBED + +/* + embed synopsis + +namespace std { + + template <typename T> +consteval span<const T> embed(string_view resource_idenfier, + size_t offset = 0, + optional<size_t> limit = nullopt); + + template <typename T> +consteval span<const T> embed(wstring_view resource_idenfier, + size_t offset = 0, + optional<size_t> limit = nullopt); + + template <typename T> +consteval span<const T> embed(u8string_view resource_idenfier, + size_t offset = 0, + optional<size_t> limit = nullopt); + +} // namespace std + +*/ + +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/__config> +#else +# include <__config> +# include <__cstddef/byte.h> +# include <__type_traits/is_enum.h> +# include <__type_traits/is_integral.h> +# include <__type_traits/is_same.h> +# include <optional> +# include <span> +# include <string_view> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif + +_LIBCPP_PUSH_MACROS +# include <__undef_macros> + +# if !defined(_LIBCPP_HAS_EMBED) +# if __has_builtin(__builtin_std_embed) +# define _LIBCPP_HAS_EMBED 1 +# else +# define _LIBCPP_HAS_EMBED 0 +# endif +# endif + +# if _LIBCPP_HAS_EMBED != 0 ---------------- H-G-Hristov wrote:
Why is this macro needed? I think a guard around the code with this pattern is all that's needed: ```c++ #if _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed) ... #endif // _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed) ``` e.g. https://github.com/llvm/llvm-project/blob/main/libcxx/include/__type_traits/is_within_lifetime.h#L20 + tests. https://github.com/llvm/llvm-project/pull/190578 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
