Content deleted Content added
No edit summary |
Reformat code, add rank_v and fix rankof |
||
Line 8:
<source lang="cpp">
#include <type_traits>
#include <cstddef>
Line 16 ⟶ 17:
* it is an array; zero otherwise (which is the usual convention)
*/
template <typename
{
};
template<typename
struct rank<
{
};
constexpr auto rank_v = rank<T>::value;
/* Rank of an expression
Line 27 ⟶ 35:
* Let the rank of an expression be the rank of its type
*/
▲template <typename t, std::size_t n>
template <typename T>
using unqualified_t = std::remove_cv_t<std::remove_reference_t<T>>;
template <typename T>
auto rankof(T&& expr)
{
return rank_v<unqualified_t<T>>;
}
</source>
Line 35 ⟶ 50:
:<source lang="cpp">rank<T>::value</source>
or the shorter form
and the rank of an array-expression ''expr'' by▼
:<source lang="cpp">rank_v<T></source>
:<source lang="cpp">
==See also==
|