Skip to content

Instantly share code, notes, and snippets.

@zabir-nabil
Created September 26, 2015 09:22
Show Gist options
  • Save zabir-nabil/cc9cf5abca43de6a66a0 to your computer and use it in GitHub Desktop.
Save zabir-nabil/cc9cf5abca43de6a66a0 to your computer and use it in GitHub Desktop.
BitInhaler
//STL CONTAINER Deque
#include <bits/stdc++.h>
#define p_d_i(d) for(deque<int>::iterator it= d.begin();it!=d.end();it++)cout<<*it<<" ";cout<<endl;
using namespace std;
int main()
{
//same as vector
deque<int>d1;
deque<int>d2(7,89);
deque<int>d3(d2.begin()+2,d2.end()-1);
deque<int>d4(d2);
if(d1.empty())
cout<<"d1 is empty!\n";
cout<<d2[3]<<endl;
deque<int>d5(9); //size:9 all 0s
cout<<"Size of d5 is "<<d5.size()<<endl;
p_d_i(d5);
d4.push_back(13);
d4.push_back(52);
d4.push_front(976);
d4.push_front(56);
p_d_i(d4);
d4.pop_back();
p_d_i(d4);
d4.pop_front();
p_d_i(d4);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment