Everytime I write a header I end up doing something like this:
#ifndef D723E2D5_1943_4166_87CC_73F5C9C47544
#define D723E2D5_1943_4166_87CC_73F5C9C47544
#include "RandomIntegers.hpp"
...
#include "IRenderer.hpp"
namespace Pathfinding::Core { class ApplicationBuilder; }
namespace Pathfinding::Datastructures { struct Node; }
namespace Pathfinding::Core
{
class Application final : public Pathfinding::Abstract::IApplication
{
friend Pathfinding::Core::ApplicationBuilder;
private:
using PAIMenu = Pathfinding::Abstract::IMenu;
using PAIEventManager = Pathfinding::Abstract::IEventManager;
using PAAIncrementalInformedAlgorithm = Pathfinding::Abstract::AIncrementalInformedAlgorithm;
using PAIGraphOperations = Pathfinding::Abstract::IGraphOperations;
using PCApplicationState = Pathfinding::Core::ApplicationState;
using PAALatGraphWr = Pathfinding::Abstract::ALatGraphWr;
using PAIAStar = Pathfinding::Abstract::IAStar;
using PDPathfinderCachee = Pathfinding::Datastructures::PathfinderCache;
using PEMouseData = Pathfinding::Events::MouseData;
using PEBindingsContainer = Pathfinding::Events::BindingsContainer;
using PRDrawablePath = Pathfinding::Rendering::DrawablePath;
using PDNode = Pathfinding::Datastructures::Node;
using PADSFMazeGenerator = Pathfinding::Algorithms::DFSMazeGenerator;
using PRNodeStateColors = Pathfinding::Rendering::NodeStateColors;
using PAIFontLoader = Pathfinding::Abstract::IFontLoader;
using PRGradientChanger = Pathfinding::Rendering::GradientChanger;
using PAIRenderer = Pathfinding::Abstract::IRenderer;
public:
...
private:
std::unique_ptr<PAIMenu> menuUPtr = nullptr;
...
PEBindingsContainer bindings;
};
}
#endif /* D723E2D5_1943_4166_87CC_73F5C9C47544 */
but I am not sure about the using
stuff, is there a better way or is this acceptable? I am sure its better than using namespace, using Foo::Bar::Class is also not recomended at namespace scope as far as I know, so what other alternatives are there then?
PS:
I found a similar question, but its eight years old, some maybe there is something new.
What are the good practices for including namespaces in C++ that avoid more typing?
#pragma once
?