Can anyone give me an explanation about the new features of C + +.
I wonder what kind of reference that is represented by two & (is a reference, right?). What is and when should I use? If you can give me an example. The "Move Semantics" is something like a copy constructor or operator? Would use it to move data from one container to another? If you can give me rough example of where these features apply?
-------------------------------------------------- ---------------------------
And the variadic template? It would be nice if this separate head to tail, like the lists in haskell and prolog. Or you can do this?
You can separate the head type of a variadic template like this:
1 2 3 4 5 6 7 8 9
template < class T >
void F ( T v ) // specialization for only one type passed
{
}
template < class head_type, class ...types >
void F ( head_type head, types&... args ) // get the head and rest of the arguments
{
F ( args... ); // (sort-of) recursive call, expanding the tail
}