2021-06-09 23:10:17 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// 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___UTILITY_AS_CONST_H
|
|
|
|
#define _LIBCPP___UTILITY_AS_CONST_H
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2022-02-01 20:16:40 -05:00
|
|
|
# pragma GCC system_header
|
2021-06-09 23:10:17 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
2023-02-14 00:56:09 +01:00
|
|
|
#if _LIBCPP_STD_VER >= 17
|
2021-06-09 23:10:17 +00:00
|
|
|
template <class _Tp>
|
2024-11-10 13:21:42 +01:00
|
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& as_const(_Tp& __t) noexcept {
|
2022-08-13 13:23:16 +02:00
|
|
|
return __t;
|
|
|
|
}
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
void as_const(const _Tp&&) = delete;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
|
|
|
#endif // _LIBCPP___UTILITY_AS_CONST_H
|