Skip to content

Commit 309f1f3

Browse files
committed
book: wrap code
Fixes #186
1 parent 6f5615b commit 309f1f3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

book/en-us/02-usability.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ be used as a formal parameter of a normal function, for example:
312312
```Cpp
313313
public:
314314
void foo(std::initializer_list<int> list) {
315-
for (std::initializer_list<int>::iterator it = list.begin(); it != list.end(); ++it) vec.push_back(*it);
315+
for (std::initializer_list<int>::iterator it = list.begin();
316+
it != list.end(); ++it) vec.push_back(*it);
316317
}
317318
318319
magicFoo.foo({6,7,8,9});
@@ -1046,7 +1047,9 @@ And we want to get the value of the enumeration value, we will have to explicitl
10461047
```cpp
10471048
#include <iostream>
10481049
template<typename T>
1049-
std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
1050+
std::ostream& operator<<(
1051+
typename std::enable_if<std::is_enum<T>::value,
1052+
std::ostream>::type& stream, const T& e)
10501053
{
10511054
return stream << static_cast<typename std::underlying_type<T>::type>(e);
10521055
}

book/zh-cn/02-usability.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ int main() {
258258
```Cpp
259259
public:
260260
void foo(std::initializer_list<int> list) {
261-
for (std::initializer_list<int>::iterator it = list.begin(); it != list.end(); ++it) vec.push_back(*it);
261+
for (std::initializer_list<int>::iterator it = list.begin();
262+
it != list.end(); ++it) vec.push_back(*it);
262263
}
263264
264265
magicFoo.foo({6,7,8,9});
@@ -964,7 +965,9 @@ if (new_enum::value3 == new_enum::value4) {
964965
```cpp
965966
#include <iostream>
966967
template<typename T>
967-
std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
968+
std::ostream& operator<<(
969+
typename std::enable_if<std::is_enum<T>::value,
970+
std::ostream>::type& stream, const T& e)
968971
{
969972
return stream << static_cast<typename std::underlying_type<T>::type>(e);
970973
}

0 commit comments

Comments
 (0)