I’m just back from an Community Event in Bad Homburg, were Boris Jabes from Visuals Studio and ++ Compiler Team had digging into brand new feature pack TR1 and MFC updates. Were quite a lot of interesting stuff, mostly known from beta version, but quite few were quite hype.
As first example – tuple function, How often in the field development we have needs as one function to have more then one return values, ok, you may said, you pass them byvalue parameters, but that’s not what an real c++ guy does, right, so here comes the "new" – Tuple.
1: int x; double y;
4: x, y = DoSomething();
An follow the code that is the TR1 Support in the new Visual C++ 2008 Feature Pack. for this purpose.
1: #include <iostream>
2: #include <tuple>
5: using namespace std;
6: using namespace tr1;
8: tuple<int, double> DoSomething()
10: int x = 10;
11: double y = 20.0;
12: return make_tuple(x,y);
16: int _tmain(int argc, _TCHAR* argv)
18: int x;
19: double y;
21: tie( x, y ) = DoSomething();
23: cout << x << endl;
24: cout << y << endl;
26: return 0;
Return value it is as tuple defined (line8) and with tie function(line 21) to the right values assigned.
Other things, quite alot, VS 2008 is cool but what’s next will be hype, at least from c++ dev. vision .
so keep learning and improve c++ , future is passion 🙂