Whats better? typedef or using

closed account (EwCjE3v7)
I was wondering what is the better of the two type alias

the using name = type or typedef type name.

Like are there advantages in any?
They are actually the same. I prefer first one for more intuitive behavior when working with function pointers and consistency with other code. Second one is just C compatibility.
The functionality provided by an an alias declaration is a superset of that provided by a typedef.

1
2
template < typename  T > 	
using my_vector = std::vector< T, my_pool_allocator<T> > ;


An alias declaration may result more easily understandable syntax (to those who have just started learning C++).
Other than that, there is no difference between the two.

1
2
3
4
5
typedef int function_type( int, int ) ;

using function_type = int( int, int ) ;

function_type* pfn = nullptr ;
closed account (EwCjE3v7)
Thank you guys, so I should use the using, because its C++11
Topic archived. No new replies allowed.