You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation has some usings that put reduced names in enclosing namespace scope. If a user #defines TCB_SPAN_NAMESPACE_NAME to their own, this can have undesired consequences.
A different solution that avoids header pollution - to not define namespace name and use an alias like mylib::span = tcb::span does not really work because there is more than just a span class template, including non-member functions that are rather complex to alias.
I propose to move these usings to some internal namespace, eg TCB_SPAN_NAMESPACE_NAME::detail.
There's contract_violation() and (sometimes) struct contract_violation_error as well as byte... are there any others? size(), data() etc are already in the detail namespace.
292: using storage_type = detail::span_storage<ElementType, Extent>;
296: using element_type = ElementType;
297: using value_type = typename std::remove_cv<ElementType>::type;
298: using size_type = std::size_t;
299: using difference_type = std::ptrdiff_t;
300: using pointer = element_type*;
301: using const_pointer = const element_type*;
302: using reference = element_type&;
303: using const_reference = const element_type&;
304: using iterator = pointer;
305: using reverse_iterator = std::reverse_iterator<iterator>;
414: using subspan_return_t =
606: using type = ElementType;
These are mandated members of span, except for the subspan_return_t helper alias, which should probably be private.
Activity
tcbrindle commentedon Sep 1, 2020
Agreed,
byteshould be in thedetailnamespaceXeverous commentedon Sep 1, 2020
Note if you missed:
byteis one among many such aliases.tcbrindle commentedon Sep 1, 2020
There's
contract_violation()and (sometimes)struct contract_violation_erroras well asbyte... are there any others?size(),data()etc are already in thedetailnamespace.Xeverous commentedon Sep 1, 2020
This is
grep -n usingresult:tcbrindle commentedon Sep 1, 2020
Mentioned above.
These are already in a
detailnamespaceThese are mandated members of
span, except for thesubspan_return_thelper alias, which should probably beprivate.Xeverous commentedon Sep 1, 2020
Looks like there is nothing more then.