Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++20 <concepts> #526

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/libcxx/include/concepts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// -*- C++ -*-
#ifndef _EZCXX_CONCEPTS
#define _EZCXX_CONCEPTS

#include <type_traits>

#pragma clang system_header

namespace std {

template <class _Tp, class _Up>
concept same_as = is_same<_Tp, _Up>::value && is_same<_Up, _Tp>::value;

// arithmetic:

template <class _Tp>
concept integral = is_integral_v<_Tp>;

template <class _Tp>
concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;

template <class _Tp>
concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;

template <class _Tp>
concept floating_point = is_floating_point_v<_Tp>;

} // namespace std

#endif // _EZCXX_CONCEPTS