これはVC8でも動く
#include <iostream> #include <iterator> #include <vector> #include <deque> #include <algorithm> using namespace std; template <class Container> class container_convertor { Container values_; public: container_convertor(const Container& values) : values_(values) {} template <class Target> operator Target() const { return Target(values_.begin(), values_.end()); } }; template <class T> container_convertor<deque<T> > make(T a1, T a2, T a3) { deque<T> ls; ls.push_back(a1); ls.push_back(a2); ls.push_back(a3); return container_convertor<deque<T> >(ls); } int main() { vector<int> v = make(3, 1, 4); copy(v.begin(), v.end(), ostream_iterator<int>(cout, "\n")); return 0; }