为什么add_const对引用无效,比如我认为,add_const<int &>::type应该是const int &才对,
而实际上,add_const<int &>::type仍旧是int &
迷茫2017-04-17 13:15:34
References only have underlying const, not top-level const.
If add_const<int &> changes int &, its type will be int &const, which is obviously wrong
阿神2017-04-17 13:15:34
template <typename T,
bool = is_reference<T>::value ||
is_function<T>::value ||
is_const<T>::value
>
struct add_const;
Then I wrote specializations of true and false
To add a reference, there are one add_lvalue_reference
and add_rvalue_reference