---
title: "tricks"
author: "chenqi210"
date: "2012-12-31T14:21:41Z"
tags: []
categories: ["编程语言"]
slug: "tricks"
draft: false
lastmod: "2012-12-31T14:21:41Z"
id: 1757454
url: "https://chenqi210.iteye.com/blog/1757454"
---

```
#include <typeinfo>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <list>

using namespace std;

template< template<typename, typename> class container_type, typename value_type>
void foo(container_type<value_type, 
             std::allocator<value_type> > const& container) 
{
        cout << typeid(container_type).name() << endl;
        cout << typeid(value_type).name() << endl;
}

int main(int argc, char* argv[])
{
       foo(std::vector<int>());
       foo(std::list<int>());
       return EXIT_SUCCESS;
}
```