Wednesday, October 28, 2015

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Trip report: Fall 2015 ISO C++ standards meeting by Tony Van Eerd

For variant, eg

variant<int, string>

note that functions like

get<int>

already needed to check if the discriminant was an int. And throw if it was a string. Now it throws if it is a string or invalid. So no extra code. And visitation needs to check the discriminant as well, so no real extra code there either.
As for “separate tag value for invalid state internally”, assume the variant has uses an int (or enum) as the discriminant of which type is currently set (ie 0 means int, 1 means string for the above variant). -1 can mean invalid.

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

No comments:

Post a Comment