2

I recently saw some code along the lines:

typedef QuiteALongName::SomeVariable SomeVariable;

My first thought was that it might be better to write the code as:

using QuiteALongName::SomeVariable;

But, being a bit rusty, I couldn't quite put my finger on what the differences would be, or whether there were any 'gotchas' to look out for using either approach. Can anyone offer some wisdom?

Component 10
  • 10,247
  • 7
  • 47
  • 64
  • versus??? they are quite different things. – Rakib Jun 17 '14 at 09:45
  • @haccks Not related. That said, C++11 renders `typedef` obsolete. I’m all in favour of dropping it completely. – Konrad Rudolph Jun 17 '14 at 09:48
  • @Rakibul: Agreed, but in this case the typedef is specifically being used to remove the need to fully qualify the `SomeVariable` type, which is essentially the purpose of `using` is it not? – Component 10 Jun 17 '14 at 09:48

0 Answers0