/*******************************************
* Name: example7.cpp
* Describe: 可变模板参数实例7
* Author: SSCOCA
* Version: 1.00
* Date: 2018年8月9日
* Other:
*********************************************/
#include <string>
#include <iostream>
using namespace std;
template<typename... Args>class Tuple2;
template<> class Tuple2<>{};
template<typename Head, typename... Tail>
class Tuple2<Head, Tail...>{
public:
typedef Tuple2<Tail...> Composited;
Tuple2(Head val, Tail... vtail) :m_head(val), m_tail(vtail...){}
Head head(){ return m_head; }
Composited tail(){ return m_tail; }
private:
Composited m_tail;
Head m_head;
};
void main(){
Tuple2<int, string, double> t(10, "hello world", 3.99);
cout << t.head() << endl;
cout << t.tail().head()<<endl;
}