#include <bits/stdc++.h>
using
namespace
std;
bool
compare(deque<tuple<
int
,
char
,
bool
> >& myContainer1,
deque<tuple<
int
,
char
,
bool
> >& myContainer2)
{
if
(myContainer1.size() !=
myContainer2.size())
return
false
;
auto
it1 = myContainer1.begin();
auto
it2 = myContainer2.begin();
while
(it1 != myContainer1.end() &&
it2 != myContainer2.end())
{
tuple<
int
,
char
,
bool
> tp1 = (*it1);
tuple<
int
,
char
,
bool
> tp2 = (*it2);
if
(get<0>(tp1) != get<0>(tp2) ||
get<1>(tp1) != get<1>(tp2) ||
get<2>(tp1) != get<2>(tp2))
return
false
;
it1++;
it2++;
}
return
true
;
}
int
main()
{
deque<tuple<
int
,
char
,
bool
> >
myContainer1;
tuple<
int
,
char
,
bool
> tuple1;
tuple1 = make_tuple(10,
'g'
,
false
);
myContainer1.push_front(tuple1);
tuple<
int
,
char
,
bool
> tuple2;
tuple2 = make_tuple(20,
'd'
,
false
);
myContainer1.push_back(tuple2);
tuple<
int
,
char
,
bool
> tuple3;
tuple3 = make_tuple(30,
'a'
,
true
);
myContainer1.push_front(tuple3);
tuple<
int
,
char
,
bool
> tuple4;
tuple4 = make_tuple(40,
'k'
,
true
);
myContainer1.push_back(tuple4);
deque<tuple<
int
,
char
,
bool
> >
myContainer2;
myContainer2.push_front(tuple1);
myContainer2.push_back(tuple2);
myContainer2.push_front(tuple3);
myContainer2.push_back(tuple4);
deque<tuple<
int
,
char
,
bool
> >
myContainer3;
tuple<
int
,
char
,
bool
> tuple5;
tuple5 = make_tuple(1,
'a'
,
true
);
myContainer3.push_front(tuple1);
myContainer3.push_back(tuple2);
myContainer3.push_front(tuple3);
myContainer3.push_back(tuple5);
if
(compare(myContainer1, myContainer2))
cout <<
"myContainer1 and myContainer2 are equal."
;
else
cout <<
"myContainer1 and "
<<
"myContainer2 are not equal."
;
cout <<
'\n'
;
if
(compare(myContainer1, myContainer3))
cout <<
"myContainer1 and "
<<
"myContainer3 are equal."
;
else
cout <<
"myContainer1 and "
<<
"myContainer3 are not equal."
;
cout <<
'\n'
;
if
(compare(myContainer2, myContainer3))
cout <<
"myContainer2 and "
<<
"myContainer3 are equal."
;
else
cout <<
"myContainer2 and "
<<
"myContainer3 are not equal."
;
return
0;
}