fork download
  1. #include <list>
  2. #include <vector>
  3.  
  4. template<class Cont, class NewT> struct SameContNewT : public std::false_type
  5. {};
  6.  
  7. template<class T, class Alloc, class NewT>
  8. struct SameContNewT<std::list<T, Alloc>, NewT>
  9. { typedef typename std::list<NewT> type; };
  10.  
  11. template<class T, class Alloc, class NewT>
  12. struct SameContNewT<std::vector<T, Alloc>, NewT>
  13. { typedef typename std::vector<NewT> type; };
  14.  
  15. int main()
  16. {
  17. typedef std::list<int> IntList;
  18. typedef std::list<float> FloatList;
  19. typedef SameContNewT<IntList, float>::type FloatListToo;
  20. static_assert(std::is_same<FloatListToo, FloatList>::value, "No.");
  21. }
Success #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty