I know that nested namespaces are used in C++ very rarely. But I think it's a nice solution to exclude types from global scope and sometimes it helps to write programs faster when we use things like "IntelliSense" or search for documentation (maybe it's similar for C# developers).
I've tried to organize my simple 3D graphics engine library in this way. Here is its main header file:
#ifndef RAZOR_H
#define RAZOR_H
#pragma warning (disable: 4482)
#include <Windows.h>
#include <fstream>
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <map>
#include <gl\GL.h>
#include "Externals\wglext.h"
#include "Externals\gl3.h"
namespace Razor
{
namespace Framework
{
#include "DisplayOrientation.h"
#include "ButtonState.h"
#include "GameTime.h"
#include "Rect.h"
#include "Point.h"
#include "Color.h"
#include "Vector2.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Matrix.h"
#include "GameWindow.h"
#include "Game.h"
namespace IO
{
#include "File.h"
}
namespace Input
{
#include "ButtonState.h"
#include "MouseState.h"
#include "Keyboard.h"
#include "Mouse.h"
#include "TouchPanel.h"
}
namespace Graphics
{
#include "PrimitiveType.h"
#include "VertexElementFormat.h"
#include "VertexElementUsage.h"
#include "VertexElement.h"
#include "VertexDeclaration.h"
#include "OpenGLExtensions.h"
#include "DepthFormat.h"
#include "BufferUsage.h"
#include "PresentationParameters.h"
#include "RenderTarget.h"
#include "OpenGLVersion.h"
#include "Viewport.h"
#include "Shader.h"
#include "VertexShader.h"
#include "FragmentShader.h"
#include "GeometryShader.h"
#include "ShaderContainer.h"
#include "VertexBuffer.h"
#include "GraphicsDevice.h"
#include "VertexBuffer.h"
#include "GraphicsDeviceManager.h"
}
}
}
#endif // RAZOR_H
What kind of problems can I get in the future if I organize my library in this way? Do you think this is really a bad style of coding?