C++: Should I use ‘typedef’ or ‘using namespace’? [closed]

The two options you state are not equivalent. This one: using namespace project1::namespace1; pulls in everything from the namespace, giving you little control and making clashes likely. I see only cons, and no pros here. But you don’t need to use a typedef to bring in a single symbol, you can use using project1::namespace1::class1; Whether …

Read more

Why doesn’t a using-declaration work to solve the diamond problem?

Someone else can find the standard quote but I’m going to explain conceptually. It doesn’t work because a using-declaration only affects name lookup. Your using-declaration causes name lookup to succeed where it would otherwise fail, that is, it tells the compiler where to find the function f. But it does not tell it which A …

Read more

Visual Studio or Resharper functionality for placement of using directives

UPDATE – ReSharper 2016.1: This option is now moved to Code Editing → C# → Code Style → Add ‘using’ directive to the deepest scope Have you tried the ReSharper option: Languages → C# → Formatting Style → Namespace Imports → Add using directive to the deepest scope I’m not sure whether R#’s code cleanup …

Read more

The type or namespace name could not be found [duplicate]

See this question. Turns out this was a client profiling issue. PrjForm was set to “.Net Framework 4 Client Profile” I changed it to “.Net Framework 4”, and now I have a successful build. Thanks everyone! I guess it figures that after all that time spent searching online, I find the solution minutes after posting, …

Read more