#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm> // For reverse
using namespace std;
template <typename Container>
Container make(const char s[])
{
return Container(&s[0], &s[strlen(s)]);
}
int main()
{
vector<char> vector1 = make< vector<char> >("abc");
reverse(vector1.begin(), vector1.end());
assert (vector1 == make< vector<char> >("cba"));
return 0;
}
|