Skip to content

Commit cf1973d

Browse files
committed
Fix final code snippet
1 parent 4d7a94f commit cf1973d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lectures/variant.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,13 @@ $PLACEHOLDER
279279
#pragma once
280280

281281
#include <variant>
282+
#include <string>
282283

283284
// Using struct for simplicity here.
284285
struct Foo {
285286
void Print() const;
286287

287-
std::variant<int, double> value{};
288+
std::variant<int, std::string> value{};
288289
};
289290

290291
```
@@ -303,7 +304,7 @@ We implement its `Print` function in a corresponding `foo.cpp` file and, because
303304
304305
namespace {
305306
306-
// ❌ Won't compile. Does not handle double.
307+
// ❌ Won't compile. Does not handle std::string.
307308
struct BadPrinter {
308309
void operator()(int value) const {
309310
std::cout << "Integer: " << value << '\n';

0 commit comments

Comments
 (0)