xref: /freebsd/contrib/llvm-project/libcxx/include/__utility/as_lvalue.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1*5f757f3fSDimitry Andric // -*- C++ -*-
2*5f757f3fSDimitry Andric //===----------------------------------------------------------------------===//
3*5f757f3fSDimitry Andric //
4*5f757f3fSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*5f757f3fSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
6*5f757f3fSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*5f757f3fSDimitry Andric //
8*5f757f3fSDimitry Andric //===----------------------------------------------------------------------===//
9*5f757f3fSDimitry Andric 
10*5f757f3fSDimitry Andric #ifndef _LIBCPP___UTILITY_AS_LVALUE_H
11*5f757f3fSDimitry Andric #define _LIBCPP___UTILITY_AS_LVALUE_H
12*5f757f3fSDimitry Andric 
13*5f757f3fSDimitry Andric #include <__config>
14*5f757f3fSDimitry Andric 
15*5f757f3fSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16*5f757f3fSDimitry Andric #  pragma GCC system_header
17*5f757f3fSDimitry Andric #endif
18*5f757f3fSDimitry Andric 
19*5f757f3fSDimitry Andric _LIBCPP_PUSH_MACROS
20*5f757f3fSDimitry Andric #include <__undef_macros>
21*5f757f3fSDimitry Andric 
22*5f757f3fSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
23*5f757f3fSDimitry Andric 
24*5f757f3fSDimitry Andric #ifndef _LIBCPP_CXX03_LANG
25*5f757f3fSDimitry Andric 
26*5f757f3fSDimitry Andric template <class _Tp>
27*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __as_lvalue(_LIBCPP_LIFETIMEBOUND _Tp&& __t) {
28*5f757f3fSDimitry Andric   return static_cast<_Tp&>(__t);
29*5f757f3fSDimitry Andric }
30*5f757f3fSDimitry Andric 
31*5f757f3fSDimitry Andric #endif // !_LIBCPP_CXX03_LANG
32*5f757f3fSDimitry Andric 
33*5f757f3fSDimitry Andric _LIBCPP_END_NAMESPACE_STD
34*5f757f3fSDimitry Andric 
35*5f757f3fSDimitry Andric _LIBCPP_POP_MACROS
36*5f757f3fSDimitry Andric 
37*5f757f3fSDimitry Andric #endif // _LIBCPP___UTILITY_AS_LVALUE_H
38