fork(1) download
  1. #include<iostream>
  2. #include<queue>
  3. #include<vector>
  4.  
  5. template<typename T>
  6. struct queue : std::queue<T, std::vector<T>>
  7. {
  8. using std::queue<T, std::vector<T>>::queue;
  9.  
  10. std::vector<T>& to_vector () { return this->c; }
  11. };
  12.  
  13. int main ()
  14. {
  15. queue<int> q;
  16. q.push(1);
  17. q.push(2);
  18.  
  19. std::vector<int>& v = q.to_vector();
  20. for(const auto& vi : v)
  21. std::cout << vi << "\n";
  22. }
  23.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1
2