File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Original file line number Diff line number Diff line change @@ -312,7 +312,8 @@ be used as a formal parameter of a normal function, for example:
312
312
```Cpp
313
313
public:
314
314
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);
316
317
}
317
318
318
319
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
1046
1047
``` cpp
1047
1048
#include < iostream>
1048
1049
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)
1050
1053
{
1051
1054
return stream << static_cast<typename std::underlying_type<T>::type>(e);
1052
1055
}
Original file line number Diff line number Diff line change @@ -258,7 +258,8 @@ int main() {
258
258
```Cpp
259
259
public:
260
260
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);
262
263
}
263
264
264
265
magicFoo.foo({6,7,8,9});
@@ -964,7 +965,9 @@ if (new_enum::value3 == new_enum::value4) {
964
965
``` cpp
965
966
#include < iostream>
966
967
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)
968
971
{
969
972
return stream << static_cast<typename std::underlying_type<T>::type>(e);
970
973
}
You can’t perform that action at this time.
0 commit comments