This is an automated email from the ASF dual-hosted git repository. bneradt pushed a commit to branch cpp-20 in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
commit 0bd48a10061c019c4ba7d945c59f97709111a7f7 Author: Alan M. Carroll <[email protected]> AuthorDate: Wed Apr 26 10:22:54 2023 -0500 More clang 14 fixes. --- code/include/swoc/Lexicon.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/code/include/swoc/Lexicon.h b/code/include/swoc/Lexicon.h index 6692787..13f53f8 100644 --- a/code/include/swoc/Lexicon.h +++ b/code/include/swoc/Lexicon.h @@ -839,28 +839,33 @@ bwformat(BufferWriter &w, bwf::Spec const &spec, Lexicon<E> const &lex) { return w; } -template <size_t IDX, typename E> -auto -get(detail::lexicon_pair_type<E> const &p) -> typename std::tuple_element<IDX, detail::lexicon_pair_type<E>>::type { - if constexpr (IDX == 0) { - return p._value; - } else if constexpr (IDX == 1) { - return p._name; - } -} - }} // namespace swoc -template <size_t IDX, typename E> class std::tuple_element { static_assert("swoc::Lexicon::Pair tuple index out of range"); }; +namespace std { + +template <size_t IDX, typename E> class tuple_element<IDX, swoc::detail::lexicon_pair_type<E>> { + static_assert("swoc::Lexicon::Pair tuple index out of range"); +}; -template <typename E> class std::tuple_element<0, swoc::detail::lexicon_pair_type<E>> { +template <typename E> class tuple_element<0, swoc::detail::lexicon_pair_type<E>> { public: using type = E; }; -template <typename E> class std::tuple_element<1, swoc::detail::lexicon_pair_type<E>> { +template <typename E> class tuple_element<1, swoc::detail::lexicon_pair_type<E>> { public: using type = swoc::TextView; }; +template <size_t IDX, typename E> +auto +get(swoc::detail::lexicon_pair_type<E> const &p) -> typename std::tuple_element<IDX, swoc::detail::lexicon_pair_type<E>>::type { + if constexpr (IDX == 0) { + return p._value; + } else if constexpr (IDX == 1) { + return p._name; + } +} + +} // namespace std
