Path: blob/main/contrib/llvm-project/libcxx/include/__concepts/constructible.h
35262 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H9#define _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H1011#include <__concepts/convertible_to.h>12#include <__concepts/destructible.h>13#include <__config>14#include <__type_traits/is_constructible.h>1516#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17# pragma GCC system_header18#endif1920_LIBCPP_BEGIN_NAMESPACE_STD2122#if _LIBCPP_STD_VER >= 202324// [concept.constructible]25template <class _Tp, class... _Args>26concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;2728// [concept.default.init]2930template <class _Tp>31concept __default_initializable = requires { ::new _Tp; };3233template <class _Tp>34concept default_initializable = constructible_from<_Tp> && requires { _Tp{}; } && __default_initializable<_Tp>;3536// [concept.moveconstructible]37template <class _Tp>38concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;3940// [concept.copyconstructible]41// clang-format off42template <class _Tp>43concept copy_constructible =44move_constructible<_Tp> &&45constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&46constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&47constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;48// clang-format on4950#endif // _LIBCPP_STD_VER >= 205152_LIBCPP_END_NAMESPACE_STD5354#endif // _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H555657