Skip to content

namespaces are wrong #85

@JeffGarland

Description

@JeffGarland

Have a look at beman.optional here:

https://godbolt.org/z/Gc6Y9j6zf

Notice:

#include <beman/optional/optional.hpp>
....
beman::optional::optional<int> empty_opt{};

The include paths and namespaces match. Now look at inplace_vector

https://godbolt.org/z/6f7Ea8P4q

#include <beman/inplace_vector/inplace_vector.hpp>
...
using namespace beman::inplace_vector;
//gives the error:
<source>:6:24: error: 'inplace_vector' is not a namespace-name
    6 | using namespace beman::inplace_vector;

That's because inplace_vector is only in the beman namespace https://godbolt.org/z/bd3ob1bf5

The standard sez:

[CPP.NAMESPACE] RECOMMENDATION: Headers in include/beman/<short_name>/ should export entities in the beman::<short_name> namespace.

It's only a recommendation, but we should follow it in my view for consistency.

Similarly if you look at details you optional you'll see this for details. https://github.com/bemanproject/optional/blob/069cd74ff18e1f3c82d054b2f7b50dc22a926509/include/beman/optional/detail/iterator.hpp#L12

Notice the namespace is beman::optional::detail. For inplace vector we have beman::detail

namespace beman::details::inplace_vector {

which should be beman::inplace_vector::detail - even though the standard is silent on the matter (it probably shouldn't be).

This really should be an easy mechanical change.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions