implementing a queue using std::vector I tried implementing a queue using std::vector, using some properties of vector class. Is there scope for further improvement in my code, to make it more efficient?

#include&lt;bits/stdc++.h&gt;
using namespace std;
vector&lt;int&gt; q;

 void push(int d){
   q.insert(q.end(),d);
 }

 void pop(){
 q.erase(q.begin());
 }

 int front(){
 return *q.begin();
 }

 int main(){
    push(1);
    push(2);
    push(3);
    push(4);
    pop();
    cout&lt;&lt;front()&lt;&lt;endl;
     for(int i=0;i&lt;q.size();i++) cout&lt;&lt;q[i]&lt;&lt;" ";
  }
There are a number of things that could be improved here, and none of them have to do with the efficiency of the program.  The problems with this code are more fundamental.

Don't abuse using namespace std

Putting using namespace std at the top of every program is a bad habit that you'd do well to avoid.  

Don't use #include &lt;bits/stdc++.h&gt;

This is poor programming practice.  Here's why.

Eliminate global variables where possible

The q variable is global but should really be in main or still better, see the next suggestion.

Create a C++ object

Whenever you have some data structure and associated actions (such as push and pop in this case), you should be thinking object.  In this case, it's quite simple to create an object from the code you have.  I'll leave that fun to you.

Use consistent formatting

The code as posted has inconsistent indentation which makes it hard to read and understand. Pick a style and apply it consistently. 

Use more whitespace to enhance readability of the code

Instead of crowding things together like this:

 for(int i=0;i&lt;q.size();i++) cout&lt;&lt;q[i]&lt;&lt;" ";


most people find it more easily readable if you use more space:

 for (int i=0; i &lt; q.size(); i++) {
     std::cout &lt;&lt; q[i] &lt;&lt; " ";
 }


Use standard classes

Finally, there's the obvious: one could use std::queue.  I am assuming that you did not because you are still learning C++ and wanted to try to create a queue yourself.  That's fine as a programming exercise, but of course in real code, it's almost always better to use part of the standard library.