ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.04k stars 371 forks source link

etl/type_traits.h: Add support for type_identity #905

Closed tigran2008 closed 2 weeks ago

semanticdiff-com[bot] commented 2 weeks ago

Review changes with SemanticDiff.

jwellbelove commented 2 weeks ago

Did you add a unit test?

tigran2008 commented 2 weeks ago

Sorry, I overlooked that part :/

I'm away from my computer right now, but would the following be enough if I added it later?

Given this function:

template <typename T>
T add(T first, typename etl::type_identity<T>::type second) {
    return first + second;
}

The result of add(2.5, 1) would be checked if it was equal to 3.5

jwellbelove commented 2 weeks ago

That looks OK.

tigran2008 commented 2 weeks ago

Did I do this right? 😅

tigran2008 commented 2 weeks ago

Well, I changed the CHECK into a CHECK_CLOSE.