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

Feature request: Implement equivalent for std::type_identity<T> in <etl/type_traits.h> #904

Closed
tigran2008 opened this issue Jun 10, 2024 · 5 comments

Comments

@tigran2008
Copy link
Contributor

std::type_identity was added in C++20 as a way to escape type deduction in templated arguments. https://en.cppreference.com/w/cpp/types/type_identity

Manually implementing it like this seems to work, and although it's just a few lines, it'd be nice if it was built-in.

template <typename T>
struct type_identity { typedef T type; };

#if ETL_USING_CPP11
  template <typename T>
  using type_identity_t = typename type_identity<T>::type;
#endif
@jwellbelove
Copy link
Contributor

Do you want to do a Pull Request?

@tigran2008
Copy link
Contributor Author

Would I add it to etl/generators/type_traits_generator.h?

@jwellbelove
Copy link
Contributor

Yes, and then run the generator script generate_type_traits.bat

@tigran2008
Copy link
Contributor Author

Alright, cool! I'm installing cogapp right now that's why it's taking some time. 😅

@tigran2008
Copy link
Contributor Author

There we go: #905

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants