Skip to content

improve type_traits and concepts #572

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

Merged
merged 2 commits into from
Mar 29, 2025
Merged

Conversation

ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Mar 29, 2025

I've added some things since the last pr #554
Most of them are based off of Clang's implementation

Added to <type_traits>:

  • common_type
  • is_swappable is_nothrow_swappable
  • make_signed make_unsigned
  • common_reference basic_common_reference (C++20)

Added to <concepts>:

  • common_reference_with
  • common_with

I did modify std::move and std::swap, so I'll need to do some additional testing before this gets merged.

I also added the <memory> header, using __builtin_addressof to implement addressof. This function is required for implementing <functional> and a few other C++ headers

To make it easier to add Clang code to the toolchain, I've added the following to <__config>:

  • _EZCXX_HIDDEN
  • _EZCXX_INTERNAL_LINKAGE
  • _EZCXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
  • _EZCXX_HIDE_FROM_ABI
  • _EZCXX_NODEBUG
  • _EZCXX_LIFETIMEBOUND

I also added <source_location>, which is the C++20 version of __FILE__ and __LINE__

Here is what is currently missing for C++17 <type_traits>

/* C++11 */
aligned_storage
aligned_union
result_of // requires <functional>
is_trivially_copy_assignable
is_trivially_move_assignable
is_destructable // works in C++20, requires Clang 16 to work in C++11
is_nothrow_destructable // works in C++20, requires Clang 16 to work in C++11
/* C++17 */
invoke_result // requires <functional>

@mateoconlechuga mateoconlechuga merged commit 7904482 into master Mar 29, 2025
9 checks passed
@mateoconlechuga mateoconlechuga deleted the pr/improve_cxx_headers branch March 29, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants