Skip to content

Commit

Permalink
Merge pull request #177 from justusc/justusc/fix-static-template-values
Browse files Browse the repository at this point in the history
Convert templated constexpr values from static to inline.
  • Loading branch information
evaleev authored Sep 22, 2024
2 parents f3d7010 + 6eb5aff commit 2ca41e9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions btas/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,29 @@ namespace btas {
inline constexpr bool has_data_v = has_data<T>::value;

template <typename S, typename Enabler = void>
constexpr static bool has_size_v = false;
inline constexpr bool has_size_v = false;
template <typename S>
constexpr static bool has_size_v<S, std::void_t<decltype(std::declval<const S&>().size())>> = true;
inline constexpr bool has_size_v<S, std::void_t<decltype(std::declval<const S&>().size())>> = true;

template <typename S, typename Enabler = void>
constexpr static bool has_nonmember_begin_v = has_begin_v<S>; // if have member begin, std::begin will apply
inline constexpr bool has_nonmember_begin_v = has_begin_v<S>; // if have member begin, std::begin will apply
template <typename S>
constexpr static bool has_nonmember_begin_v<S, std::void_t<decltype(begin(std::declval<S&>()))>> = true;
inline constexpr bool has_nonmember_begin_v<S, std::void_t<decltype(begin(std::declval<S&>()))>> = true;

template <typename S, typename Enabler = void>
constexpr static bool has_nonmember_end_v = has_end_v<S>; // if have member end, std::end will apply
inline constexpr bool has_nonmember_end_v = has_end_v<S>; // if have member end, std::end will apply
template <typename S>
constexpr static bool has_nonmember_end_v<S, std::void_t<decltype(end(std::declval<S&>()))>> = true;
inline constexpr bool has_nonmember_end_v<S, std::void_t<decltype(end(std::declval<S&>()))>> = true;

template <typename S, typename Enabler = void>
constexpr static bool has_nonmember_data_v = has_data_v<S>; // if have member data, std::data will apply
inline constexpr bool has_nonmember_data_v = has_data_v<S>; // if have member data, std::data will apply
template <typename S>
constexpr static bool has_nonmember_data_v<S, std::void_t<decltype(data(std::declval<S&>()))>> = true;
inline constexpr bool has_nonmember_data_v<S, std::void_t<decltype(data(std::declval<S&>()))>> = true;

template <typename S, typename Enabler = void>
constexpr static bool has_nonmember_size_v = has_end_v<S>; // if have member size, std::size will apply
inline constexpr bool has_nonmember_size_v = has_end_v<S>; // if have member size, std::size will apply
template <typename S>
constexpr static bool has_nonmember_size_v<S, std::void_t<decltype(size(std::declval<const S&>()))>> = true;
inline constexpr bool has_nonmember_size_v<S, std::void_t<decltype(size(std::declval<const S&>()))>> = true;

// Checks if an iterator is random access
template <typename _Iterator>
Expand Down

0 comments on commit 2ca41e9

Please sign in to comment.