4 ms·
In the OP example, "using" has the same semantics as "typedef". The new syntax emerged from the need for "template typedefs". http://www.stroustrup.com/C++11FA
by yannickt 14y ago
In the OP example, "using" has the same semantics as "typedef". The new syntax emerged from the need for "template typedefs".
http://www.stroustrup.com/C++11FAQ.html#template-alias http://www.stroustrup.com/C++11FAQ.html#template-alias
- jamesaguilar 14y agoOh. I wish they would have just shoehorned it into typedef somehow. I guess they must have had reasons why they couldn't.
- pmr_ 14y agoThe alias syntax has the benefit of not requiring typename everywhere because the syntax requires the right parts to be types and doesn't allow for ambiguities as does typedef. This makes code in dependent contexts a lot easier to read and to write.
- snogglethorpe 14y ago+1 on that; people intuitively expect template'd typedefs to work until they discover they don't. Oh well. You can read about the reasoning behind the new syntax here: http://www.emarcus.org/papers/n1449.pdf http://www.emarcus.org/papers/n1449.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1489.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n148...