Skip to main content

Posts

Showing posts with the label STL

Tuples: are they useful?

In some languages there is such a thing as tuple which makes real to write such code (this time it's in python): def f(x):  #   do stuff return (True, modified_string) success, modified_string = f(something)  C++ hadn't such feature until C++11. That was one of the reasons to pass variable as referenced argument, which ended up creating huge code bases that have unused arguments in it's functions. That happened in order to save revers compatibility and allow clients to use stable interfaces to access libraries without checking the version of dynamically attached library in order to use correct functions.

Going up step by step

Have you ever wanted to be able to iterate through your own class as if it was a cool STL container?