Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/stdx/env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ template <typename Q> struct has_query {

template <typename... Envs> struct env {
template <_env::valid_query_over<Envs...> Q>
CONSTEVAL static auto query(Q) noexcept {
[[nodiscard]] CONSTEVAL static auto query(Q) noexcept {
using I = boost::mp11::mp_find_if_q<boost::mp11::mp_list<Envs...>,
_env::has_query<Q>>;
using E = nth_t<I::value, Envs...>;
Expand Down
8 changes: 4 additions & 4 deletions include/stdx/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ class span : public detail::span_base<T, Extent> {
"Span extends beyond available storage");
}

// NOLINTNEXTLINE(*-avoid-c-arrays)
template <std::size_t N> using arr_t = type_identity_t<element_type> (&)[N];

template <std::size_t N>
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr span(
// NOLINTNEXTLINE(*-avoid-c-arrays)
stdx::type_identity_t<element_type> (&arr)[N] LIFETIMEBOUND) noexcept
: ptr{std::data(arr)} {
constexpr span(arr_t<N> arr LIFETIMEBOUND) noexcept : ptr{std::data(arr)} {
static_assert(Extent == dynamic_extent or Extent <= N,
"Span extends beyond available storage");
}
Expand Down
7 changes: 4 additions & 3 deletions include/stdx/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ struct call_base {
};

template <typename, bool> struct callable_test : call_base {};
template <typename F> struct callable_test<F, true> : F, call_base {};
template <typename F>
struct callable_test<F, true> : remove_cvref_t<F>, call_base {};

template <typename F, typename = void> constexpr auto is_func_obj = true;
template <typename F>
Expand Down Expand Up @@ -144,7 +145,7 @@ struct for_each_t<L<Vs...>> {
(f.template operator()<Vs>(), ...);
}
};
template <template <typename, auto...> typename L, typename T, T... Vs>
template <template <typename X, X...> typename L, typename T, T... Vs>
struct for_each_t<L<T, Vs...>> {
template <typename F> constexpr auto operator()(F &&f) const {
(f.template operator()<Vs>(), ...);
Expand Down Expand Up @@ -174,7 +175,7 @@ struct apply_sequence_t<L<Vs...>> {
return f.template operator()<Vs...>();
}
};
template <template <typename, auto...> typename L, typename T, T... Vs>
template <template <typename X, X...> typename L, typename T, T... Vs>
struct apply_sequence_t<L<T, Vs...>> {
template <typename F> constexpr auto operator()(F &&f) const {
return f.template operator()<Vs...>();
Expand Down
4 changes: 2 additions & 2 deletions test/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ namespace {
[[maybe_unused]] constexpr inline struct custom_t {
template <typename T>
requires true // more constrained
CONSTEVAL auto operator()(T &&t) const
[[nodiscard]] CONSTEVAL auto operator()(T &&t) const
noexcept(noexcept(std::forward<T>(t).query(std::declval<custom_t>())))
-> decltype(std::forward<T>(t).query(*this)) {
return std::forward<T>(t).query(*this);
}

CONSTEVAL auto operator()(auto &&) const { return 42; }
[[nodiscard]] CONSTEVAL auto operator()(auto &&) const { return 42; }
} custom;
} // namespace

Expand Down