Skip to content

Type modifications

Type modification templates create new type definitions by applying modifications on a template parameter. The resulting type can then be accessed through type member typedef.

NOTE: 各种type modification的实现也是使用的trait技术;

在文章 http://bajamircea.github.io/coding/cpp/2016/04/07/move-forward.html 中提及了std::remove_reference ,意思是通过std::remove_reference ,我们可以获得template argument的underlying type;我们需要举一反三,Type modifications系列函数的作用和std::remove_reference类似:获得template argument的underlying type

References

cppreference std::remove_reference

NOTE: 使用std::remove_reference的典型例子就是std::move,在C++\Language-reference\Reference\Move-semantic\std-move.md中对它进行了详细分析。

Const-volatility specifiers

cppreference std::remove_cv, std::remove_const, std::remove_volatile