@@ -284,6 +284,7 @@ My favorite tool for this is the [`CHECK`](https://abseil.io/docs/cpp/guides/log
284
284
<!--
285
285
` CPP_SETUP_START `
286
286
#include <vector >
287
+ #include <algorithm >
287
288
288
289
#define CHECK_GE(expr, value)
289
290
#define CHECK_LT(expr, value)
@@ -357,6 +358,7 @@ First, we can use `assert` in a very similar way to `CHECK`:
357
358
<!--
358
359
`CPP_SETUP_START`
359
360
#include <vector>
361
+ #include <algorithm>
360
362
361
363
struct ChangeEntry {
362
364
int index{};
@@ -515,6 +517,7 @@ In our example, we could throw an object of `std::out_of_range` when the user in
515
517
<!--
516
518
`CPP_SETUP_START`
517
519
#include <iostream>
520
+ #include <vector>
518
521
519
522
struct ChangeEntry {
520
523
int index{};
@@ -554,6 +557,7 @@ Speaking of handling exceptions, we can "catch" them anywhere upstream from the
554
557
<!--
555
558
`CPP_SETUP_START`
556
559
#include <iostream>
560
+ #include <vector>
557
561
558
562
struct ChangeEntry {
559
563
int index{};
@@ -650,6 +654,7 @@ In our own example, if, the `ChangePlayerNumberIfPossible` function throws an un
650
654
<!--
651
655
`CPP_SETUP_START`
652
656
#include <iostream>
657
+ #include <vector>
653
658
654
659
struct ChangeEntry {
655
660
int index{};
@@ -730,6 +735,7 @@ There is a number of issues with returning a special value from a function witho
730
735
<!--
731
736
`CPP_SETUP_START`
732
737
#include <iostream>
738
+ #include <vector>
733
739
734
740
struct ChangeEntry {
735
741
int index{};
@@ -825,6 +831,7 @@ Consider how we would use this function:
825
831
<!--
826
832
`CPP_SETUP_START`
827
833
#include <iostream>
834
+ #include <vector>
828
835
829
836
constexpr inline int kError = 1;
830
837
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
891
898
<!--
892
899
`CPP_SETUP_START`
893
900
#include <iostream>
901
+ #include <vector>
894
902
895
903
constexpr inline int kError = 1;
896
904
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
938
946
<!--
939
947
`CPP_SETUP_START`
940
948
#include <iostream>
949
+ #include <vector>
941
950
942
951
struct ChangeEntry {
943
952
int index{};
0 commit comments