Skip to content

Commit

Permalink
move 11.15,16,17,19 to README
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Dec 16, 2014
1 parent 0d66d06 commit 0f968be
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 113 deletions.
35 changes: 0 additions & 35 deletions ch11/11_17.cpp

This file was deleted.

38 changes: 38 additions & 0 deletions ch11/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,41 @@ I use `set` when i just need to store the `key`, In other hand, I would like u
## [Exercise 11.11](ex11_11.cpp)
## [Exercise 11.12 and 11.13](ex11_12_13.cpp)
## [Exercise 11.14](ex11_14.cpp)

## Exercise 11.15:
>What are the mapped_type, key_type, and value_type of a map from int to vector<int>?
- mapped_type : vector<int>
- key_type : int
- value_type : std::pair<int, vector<int>>

## Exercise 11.16:
>Using a map iterator write an expression that assigns a value to an element.
```cpp
std::map<int, std::string> map;
map[25] = "Alan";
std::map<int, std::string>::iterator it = map.begin();
it->second = "Wang";
```

## Exercise 11.17:
>Assuming c is a multiset of strings and v is a vector
of strings, explain the following calls. Indicate whether each call is legal:

```cpp
copy(v.begin(), v.end(), inserter(c, c.end())); // legal
copy(v.begin(), v.end(), back_inserter(c)); // illegal, no `push_back` in `set`.
copy(c.begin(), c.end(), inserter(v, v.end())); // legal.
copy(c.begin(), c.end(), back_inserter(v)); // legal.
```
## [Exercise 11.18](ex11_18.cpp)
## Exercise 11.19:
>Define a variable that you initialize by calling begin() on the multiset named bookstore from 11.2.2 (p. 425).
Write the variable’s type without using auto or decltype.
```cpp
using compareType = bool (*)(const Sales_data &lhs, const Sales_data &rhs);
std::multiset<Sales_data, compareType> bookstore(compareIsbn);
std::multiset<Sales_data, compareType>::iterator c_it = bookstore.begin();
```
35 changes: 0 additions & 35 deletions ch11/ex11_15_16.cpp

This file was deleted.

5 changes: 0 additions & 5 deletions ch11/ex11_18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <iterator>


int main()
{
Expand Down
38 changes: 0 additions & 38 deletions ch11/ex11_19.cpp

This file was deleted.

0 comments on commit 0f968be

Please sign in to comment.