I keep running into this issue:
class CCreateShortcutTask : public CTask
{
public:
CCreateShortcutTask(
CFilename filename, // shortcut to create (or overwrite)
Toolbox::Windows::CShellLinkInfo definition // shortcut definition
)
...
Having to spell out Toolbox::Windows::CShellLinkInfo seems highly questionable to me. This is in a header, so I surely don’t wish to issue a using namespace declaration or I’ll drag that namespace into every client file that includes this header.
But I don’t seriously want to have to fully name these things in the class interface itself. I’d really love to be able to do something like:
class CCreateShortcutTask : public CTask
{
using namespace Toolbox::Windows;
-or possibly-
using Toolbox::Windows::CShellLinkInfo;
public:
CCreateShortcutTask(
CFilename filename, // shortcut to create (or overwrite)
CShellLinkInfo definition // shortcut definition
)
...
But these seem to be illegal constructs.
Any ideas how to accomplish this?
I think there is a confusion on typedefs.
Using private typedefs is perfectly suitable (and often used). This relies on the fact that in C++ a typedef does not introduce a new type, but a synonym!
Thus, private typedefs don’t bother:
destroyis correctly invokediteratoris foundPrintis foundSo you can really use them without many fuss. Furthermore they don’t pollute the global space since they are inner to the class and though visible cannot be manipulated by the client directly so he does not rely on them.
Within the source file, you can use namespace aliasing and using directives (not using namespaces please) more liberally, so it’s less of an issue.