1*349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 2*349cc55cSDimitry Andric // 3*349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*349cc55cSDimitry Andric // 7*349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 8*349cc55cSDimitry Andric 9*349cc55cSDimitry Andric #ifndef _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H 10*349cc55cSDimitry Andric #define _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H 11*349cc55cSDimitry Andric 12*349cc55cSDimitry Andric #include <__concepts/convertible_to.h> 13*349cc55cSDimitry Andric #include <__concepts/destructible.h> 14*349cc55cSDimitry Andric #include <__config> 15*349cc55cSDimitry Andric #include <type_traits> 16*349cc55cSDimitry Andric 17*349cc55cSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 18*349cc55cSDimitry Andric #pragma GCC system_header 19*349cc55cSDimitry Andric #endif 20*349cc55cSDimitry Andric 21*349cc55cSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 22*349cc55cSDimitry Andric 23*349cc55cSDimitry Andric #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS) 24*349cc55cSDimitry Andric 25*349cc55cSDimitry Andric // [concept.constructible] 26*349cc55cSDimitry Andric template<class _Tp, class... _Args> 27*349cc55cSDimitry Andric concept constructible_from = 28*349cc55cSDimitry Andric destructible<_Tp> && is_constructible_v<_Tp, _Args...>; 29*349cc55cSDimitry Andric 30*349cc55cSDimitry Andric // [concept.default.init] 31*349cc55cSDimitry Andric 32*349cc55cSDimitry Andric template<class _Tp> 33*349cc55cSDimitry Andric concept __default_initializable = requires { ::new _Tp; }; 34*349cc55cSDimitry Andric 35*349cc55cSDimitry Andric template<class _Tp> 36*349cc55cSDimitry Andric concept default_initializable = constructible_from<_Tp> && 37*349cc55cSDimitry Andric requires { _Tp{}; } && __default_initializable<_Tp>; 38*349cc55cSDimitry Andric 39*349cc55cSDimitry Andric // [concept.moveconstructible] 40*349cc55cSDimitry Andric template<class _Tp> 41*349cc55cSDimitry Andric concept move_constructible = 42*349cc55cSDimitry Andric constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>; 43*349cc55cSDimitry Andric 44*349cc55cSDimitry Andric // [concept.copyconstructible] 45*349cc55cSDimitry Andric template<class _Tp> 46*349cc55cSDimitry Andric concept copy_constructible = 47*349cc55cSDimitry Andric move_constructible<_Tp> && 48*349cc55cSDimitry Andric constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> && 49*349cc55cSDimitry Andric constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && 50*349cc55cSDimitry Andric constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; 51*349cc55cSDimitry Andric 52*349cc55cSDimitry Andric #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS) 53*349cc55cSDimitry Andric 54*349cc55cSDimitry Andric _LIBCPP_END_NAMESPACE_STD 55*349cc55cSDimitry Andric 56*349cc55cSDimitry Andric #endif // _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H 57