Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[atomics.syn] doesn't depict memory_order_meow #5385

Closed
StephanTLavavej opened this issue Apr 4, 2022 · 5 comments · Fixed by #5396
Closed

[atomics.syn] doesn't depict memory_order_meow #5385

StephanTLavavej opened this issue Apr 4, 2022 · 5 comments · Fixed by #5396
Assignees

Comments

@StephanTLavavej
Copy link
Contributor

As of N4910, [atomics.order] defines:

namespace std {
  enum class memory_order : unspecified {
    relaxed, consume, acquire, release, acq_rel, seq_cst
  };
  inline constexpr memory_order memory_order_relaxed = memory_order::relaxed;
  inline constexpr memory_order memory_order_consume = memory_order::consume;
  inline constexpr memory_order memory_order_acquire = memory_order::acquire;
  inline constexpr memory_order memory_order_release = memory_order::release;
  inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel;
  inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst;
}

However, these inline constexpr variables within namespace std don't appear within [atomics.syn] which says only:

namespace std {
  // 33.5.4, order and consistency
  enum class memory_order : unspecified ;
  template<class T>
    T kill_dependency(T y) noexcept;
}

I am unsure of the editorial conventions here, but as an implementer of the proposed Standard Library Modules, I find it most helpful when the header synopsis lists all top-level inhabitants of namespace std.

@CaseyCarter
Copy link
Contributor

I find it most helpful when the header synopsis lists all top-level inhabitants of namespace std.

Would that include deduction guides? We notably do not depict the declarations of deduction guides in the header synopses, they are conventionally declared together with the corresponding class template synopsis. (Which fact I personally have always found odd.)

Should our conventions ensure that all namespace-scope declarations (except those which exist only for exposition) appear in header synopses?

@StephanTLavavej
Copy link
Contributor Author

For modules, deduction guides are "invisible" (in the sense that we don't/can't directly export them, they're just associated with the primary template in some magical way). There may still be reasons for an editorial preference to put them in the header synopsis, but seeing what's in the std module wouldn't be such a reason.

@StephanTLavavej
Copy link
Contributor Author

Similar example (I can file a separate issue if the editors want):

[ranges.syn] depicts only:

// 26.5.4, sub-ranges
enum class subrange_kind : bool { unsized, sized };

template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below >
  requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
class subrange;

template<class I, class S, subrange_kind K>
  inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;

However, [range.subrange.general] defines more:

namespace std::ranges {
  // [...exposition only machinery...]

  template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K =
      sized_sentinel_for<S, I> ? subrange_kind::sized : subrange_kind::unsized>
    requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
  class subrange : public view_interface<subrange<I, S, K>> {
    // [...class definition...]
  };
  
  // [...deduction guides...]
  
  template<size_t N, class I, class S, subrange_kind K>
    requires ((N == 0 && copyable<I>) || N == 1)
    constexpr auto get(const subrange<I, S, K>& r);
  
  template<size_t N, class I, class S, subrange_kind K>
    requires (N < 2)
    constexpr auto get(subrange<I, S, K>&& r);
}

namespace std {
  using ranges::get;
}

I expected to see get(const subrange&), get(subrange&&), and using ranges::get; appear in the <ranges> synopsis.

@jwakely
Copy link
Member

jwakely commented Apr 17, 2022 via email

@jensmaurer
Copy link
Member

jensmaurer commented Apr 17, 2022

The current operative rule is that deduction guides go with the class synopsis; any other namespace-scope declaration (which need not be a definition) is shown in the header synopsis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants