| ||||
| Comment on Trip report: Summer ISO C++ standards meeting (Oulu) by Thomas McLeod
Now that C++17 is feature complete, is there a definitive write up that covers the 17/14 delta? Read More »Comment on Trip report: Summer ISO C++ standards meeting (Oulu) by Herb Sutter
@F.Mehrabi: No, because a variant is not a structure of N values to which structured binding would apply, it’s a sum type that holds a single value (1 of N alternatives but only 1 at a time). That’s why variant deliberately doesn’t advertise itself as a tuple, which would be incorrect; in particular it doesn’t specialize tuple_size, which is what is required by structured bindings (for everything but arrays which are special-cased). See the variant proposal paper linked… quoting: Read More » Comment on Trip report: Summer ISO C++ standards meeting (Oulu) by F.Mehrabi
Isn’t there a conflict between structured-binding and variant? variant interfaces an int argument-ed get with mutually exclusive integer inputs.So is there a possiblity of run-time exeption in the following example? auto f(){ std::variant<int,double,char> var='x'; ... return var; }; auto [x,y,z] =f();//can this compile and run without exception??? I smell trouble unless I am missing something(e.g get(variant) returns optional or it is renamed to something else…). Read More » | ||||
| | ||||
| ||||
Thursday, July 7, 2016
FeedaMail: Comments for Sutterâs Mill
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment