Advertisement
bueddl

how std::type_traits work

Mar 2nd, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <string>
  2.  
  3. namespace op {
  4.  
  5. template<typename T>
  6. struct remove_const {
  7.     typedef T type;
  8. };
  9.  
  10. template<typename T>
  11. struct remove_const<T const> {
  12.     typedef T type;
  13. };
  14. }
  15.  
  16. int main()
  17. {
  18.     using T = op::remove_const<const std::string>::type;
  19.  
  20.     T str = "Das";
  21.     str += " ist ein Test!";
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement