Skip to content

Commit 2cb00a3

Browse files
committed
updated example
1 parent e03f378 commit 2cb00a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/standard-library/in-place-t-struct.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The following class types use these structs in their constructors: `expected`, [
6969
struct MyStruct
7070
{
7171
double value;
72-
MyStruct(double v0, double v1) : value(v0 + v1) {}
72+
MyStruct(double v0, double v1 = 0) : value(v0 + v1) {}
7373
};
7474

7575
int main()
@@ -78,10 +78,10 @@ int main()
7878
std::optional<MyStruct> opt(std::in_place, 29.0, 13.0);
7979

8080
// Construct a MyStruct object inside an any object
81-
std::any a(std::in_place_type<MyStruct>, 3.0, 0.14);
81+
std::any a(std::in_place_type<MyStruct>, 3.14);
8282

8383
// Construct a MyStruct object inside a vector at index 0
84-
std::variant<MyStruct, int> v(std::in_place_index<0>, 2.0, 0.718);
84+
std::variant<MyStruct, int> v(std::in_place_index<0>, 2.718);
8585

8686
if (opt)
8787
{

0 commit comments

Comments
 (0)