2 ms·
Smelly std::pair and std::tuple
- makecheck 10y agoI think Python's "named tuple" is an interesting middle approach. It allows a somewhat-descriptive collection of data fields that has the benefits of a class without requiring quite as much effort to create. Therefore, a Python named tuple has some immediately-obvious benefits (unlike the C++ std::tuple<>, whose benefits are FAR less clear). Off the top of my head, the main value in tuple<> would be to greatly simplify the effort of implementing certain operators in a class, such as less-than.