I have two versions of the what I'd expect to be the same function but gcc says version 1 is valid while version 2 gives a
expected a type, got 'std::remove_cv<_Iter>::type' I don't quite understand this error, as I'd expect that the using statement required a type, and wouldn't automatically promote a 'std::remove_cv<_Iter>::type' to something else?
Can somebody explain whats going on here?
template<typename U,typename V> constexpr inline auto is_same_rcv() noexcept { //version 1 works using u_underlying = std::remove_cv<U>::type; using v_underlying = std::remove_cv<V>::type; return std::is_same<u_underlying,v_underlying>::value; } and
template<typename U,typename V> constexpr inline auto is_same_rcv() noexcept { //version 2 doesn't work using u_underlying = std::remove_cv<U>::type; return std::is_same<u_underlying,std::remove_cv<V>::type>::value; } Associated godbolt
https://stackoverflow.com/questions/66701132/why-is-a-stdremove-cv-itertype-not-a-type March 19, 2021 at 08:50AM
没有评论:
发表评论