Skip to content

Commit

Permalink
added 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Dec 9, 2014
1 parent 8d334aa commit 0768863
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ch10/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Chapter 10. Generic Algorithms

##[Exercise 10.1 and 10.2](ex10_1_2.cpp)
##[Exercise 10.1 and 10.2](ex10_01_02.cpp)
##[Exercise 10.3 and 10.4](ex10_03_04.cpp)
##[Exercise 10.5](ex10_05.cpp)
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions ch10/ex10_05.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// ex10_05.cpp
// Exercise 10.5
//
// Created by pezy on 11/9/14.
// Copyright (c) 2014 pezy. All rights reserved.
//
// @Brief In the call to equal on rosters, what would happen if both rosters held C-style strings, rather than library strings?
// @Answer It's the same as `std::string`

#include <algorithm>
#include <iostream>
#include <vector>
#include <list>

int main()
{
std::vector<const char *> roster1{"Mooophy", "pezy", "Queequeg"};
std::list<const char *> roster2{"Mooophy", "pezy", "Queequeg", "shbling", "evan617"};
std::cout << std::equal(roster1.cbegin(), roster1.cend(), roster2.cbegin());
}

// out
// 1

0 comments on commit 0768863

Please sign in to comment.