Skip to content

Commit e1f0b51

Browse files
committed
Fix errors in snippets reported by CI
1 parent a8ca676 commit e1f0b51

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lectures/error_handling.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ My favorite tool for this is the [`CHECK`](https://abseil.io/docs/cpp/guides/log
284284
<!--
285285
`CPP_SETUP_START`
286286
#include <vector>
287+
#include <algorithm>
287288

288289
#define CHECK_GE(expr, value)
289290
#define CHECK_LT(expr, value)
@@ -357,6 +358,7 @@ First, we can use `assert` in a very similar way to `CHECK`:
357358
<!--
358359
`CPP_SETUP_START`
359360
#include <vector>
361+
#include <algorithm>
360362
361363
struct ChangeEntry {
362364
int index{};
@@ -515,6 +517,7 @@ In our example, we could throw an object of `std::out_of_range` when the user in
515517
<!--
516518
`CPP_SETUP_START`
517519
#include <iostream>
520+
#include <vector>
518521
519522
struct ChangeEntry {
520523
int index{};
@@ -554,6 +557,7 @@ Speaking of handling exceptions, we can "catch" them anywhere upstream from the
554557
<!--
555558
`CPP_SETUP_START`
556559
#include <iostream>
560+
#include <vector>
557561
558562
struct ChangeEntry {
559563
int index{};
@@ -650,6 +654,7 @@ In our own example, if, the `ChangePlayerNumberIfPossible` function throws an un
650654
<!--
651655
`CPP_SETUP_START`
652656
#include <iostream>
657+
#include <vector>
653658
654659
struct ChangeEntry {
655660
int index{};
@@ -730,6 +735,7 @@ There is a number of issues with returning a special value from a function witho
730735
<!--
731736
`CPP_SETUP_START`
732737
#include <iostream>
738+
#include <vector>
733739
734740
struct ChangeEntry {
735741
int index{};
@@ -825,6 +831,7 @@ Consider how we would use this function:
825831
<!--
826832
`CPP_SETUP_START`
827833
#include <iostream>
834+
#include <vector>
828835
829836
constexpr inline int kError = 1;
830837
constexpr inline int kSuccess = 0;
@@ -891,6 +898,7 @@ I believe that there *is* a better way though. With C++17, we gained [`std::opti
891898
<!--
892899
`CPP_SETUP_START`
893900
#include <iostream>
901+
#include <vector>
894902
895903
constexpr inline int kError = 1;
896904
constexpr inline int kSuccess = 0;
@@ -938,6 +946,7 @@ We can use our newly-returned optional object in an `if` statement to find out i
938946
<!--
939947
`CPP_SETUP_START`
940948
#include <iostream>
949+
#include <vector>
941950
942951
struct ChangeEntry {
943952
int index{};

0 commit comments

Comments
 (0)