递归输出vector
// recursive.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "recursive.h"
#include <cassert>
#include <iostream>
using std::endl; using std::cout; using std::cerr;
int main()
{
vector <int> i{ 0,1,2,3,4,5,6,7,8,9 };
vprintf(i);
return 0;
}
inline
void vprintf(vector<int> &ivec)
{
static auto sz = ivec.size();
if (sz != 0) {
cout << ivec[--sz]<<" ";
cerr << "size: " << sizeof(ivec[sz]) << " " << "at line" << __LINE__ << endl;
vprintf(ivec);
}
}