forked from pezy/CppPrimer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex9_16.cpp
More file actions
27 lines (23 loc) · 662 Bytes
/
ex9_16.cpp
File metadata and controls
27 lines (23 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//
// ex9_16.cpp
// Exercise 9.16
//
// Created by pezy on 12/2/14.
// Copyright (c) 2014 pezy. All rights reserved.
//
// @Brief Repeat the previous program, but compare elements in a
// list<int> to a vector<int>.
#include <iostream>
#include <vector>
#include <list>
int main()
{
std::list<int> vec1{1,2,3,4,5};
std::vector<int> vec2{1,2,3,4,5};
std::vector<int> vec3{1,2,3,4};
std::cout << (std::vector<int>(vec1.begin(), vec1.end()) == vec2 ? "true" : "false")
<< std::endl;
std::cout << (std::vector<int>(vec1.begin(), vec1.end()) == vec3 ? "true" : "false")
<< std::endl;
return 0;
}