I'm going to create a new library that renders genome annotations into charts. However, as C++ doesn't have a centralized library website like Perl, how do I know if the namespace conflicts with any existing one?
No, xd
is not a good name: it's too short. It could be a good alias in a limited context, but for a library that will be used by others, provide a long, descriptive name. Then users can select an alias that makes sense for their project.
namespace my_company {
namespace XnoDraw {
// ...
} // namespace XnoDraw
} // namespace my_company
// user code, not your code:
namespace xd = my_company::XnoDraw;
You could use anything except std
.
Note that c++ doesn't allow compound names for namespaces.
For instance:
// Allowed
namespace a
{
namespace b
{
int c;
}
}
// Not allowed
namespace a::b
{
int c;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With