vc++ 2010/2012: std::vector of a struct containing unique_ptr compiler error
===

The following code generates the compiler error below (after the code), but not if the vector contains unique_ptr's directly (see commented code lines). Any ideas why?

The question is more concerned with the code block in the "#if 1" block, the "#else" block generates the error (after changing "#if 1" to "#if 0") that is similar, but is more expected.

	// MoveSemantics.cpp : Defines the entry point for the console application.
	//

	#include "stdafx.h"
	#include <memory>
	#include <vector>

	typedef std::unique_ptr<int> upi;

	struct S
	{
		S() : p(new int(123)) {}
		S(S&& s) : p( std::move(s.p) ) {} // NB: the move constructor is supposed to be used? (but not)
		upi p;
	};

	#if 1
	void test()
	{
		//std::vector<S> vs; // Okay
		//std::vector<upi> vupi(10); // Okay
		std::vector<S> vs(10); // Error! why in the hell does the compiler want to generate a copy constructor here??
	}
	#else
	void test()
	{
		std::vector<S> vs;

		vs.push_back( S() );
		const S& s = vs.front();
		//S& s = vs.front(); // fine!
		S s1 = std::move(s); // Error, but expected
	}
	#endif
	int _tmain(int argc, _TCHAR* argv[])
	{
		return 0;
	}

Compiler Error:

    1>c:\users\lin\documents\visual studio 2012\projects\movesemantics\movesemantics.cpp(15): error C2248: 'std::unique_ptr<_Ty>::operator =' : cannot access private member declared in class 'std::unique_ptr<_Ty>'
    1>          with
    1>          [
    1>              _Ty=int
    1>          ]
    1>          c:\program files\microsoft visual studio 11.0\vc\include\memory(1435) : see declaration of 'std::unique_ptr<_Ty>::operator ='
    1>          with
    1>          [
    1>              _Ty=int
    1>          ]
    1>          This diagnostic occurred in the compiler generated function 'S &S::operator =(const S &)'

