Fix compilation error with as_deque in C++11.

In C++11, `as_deque` did not compile for even simple use cases. I added a unit test and a fix (which is not 100% clean, see inline comments). With the patch applied, all the unit tests are passing on develop with Apple's Clang and -std=c++1y.
Makes sense. Yes, that will add too much compile time.