From b42c511bcadbb4edcd8753da764d45deb15396bd Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Mon, 13 Mar 2023 16:28:51 -0500 Subject: [PATCH] Renamed inserter to __appender, moved functions into concat_impl namespace For open-source SYCL bundle based on clang 17.0 and using GCC 10.2 toolchain compilation error about ambiguous call to inserter was encountered. This was because of name clash between the definition in this file and std::inserter. Renaming helped resolve that. Thank you @ZzEeKkAa for reportign this issue. --- .../source/boolean_advanced_indexing.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dpctl/tensor/libtensor/source/boolean_advanced_indexing.cpp b/dpctl/tensor/libtensor/source/boolean_advanced_indexing.cpp index 9689612b8a..1fcf74eead 100644 --- a/dpctl/tensor/libtensor/source/boolean_advanced_indexing.cpp +++ b/dpctl/tensor/libtensor/source/boolean_advanced_indexing.cpp @@ -44,36 +44,44 @@ namespace tensor namespace py_internal { +namespace concat_impl +{ + struct sink_t { sink_t(){}; template sink_t(T &&){}; }; -template std::size_t accumulate_size(std::size_t &s, V &&v) +template std::size_t __accumulate_size(std::size_t &s, V &&v) { return s += v.size(); } -template sink_t inserter(V &lhs, U &&rhs) +template sink_t __appender(V &lhs, U &&rhs) { lhs.insert(lhs.end(), rhs.begin(), rhs.end()); return {}; } +} // namespace concat_impl + template std::vector concat(std::vector lhs, Vs &&...vs) { + using concat_impl::__accumulate_size; + using concat_impl::__appender; + using concat_impl::sink_t; std::size_t s = lhs.size(); { // limited scope ensures array is freed - [[maybe_unused]] sink_t tmp[] = {accumulate_size(s, vs)..., 0}; + [[maybe_unused]] sink_t tmp[] = {__accumulate_size(s, vs)..., 0}; } lhs.reserve(s); { - // array of no-data objects ensures ordering of calls to inserter - [[maybe_unused]] sink_t tmp[] = {inserter(lhs, std::forward(vs))..., - 0}; + // array of no-data objects ensures ordering of calls to the appender + [[maybe_unused]] sink_t tmp[] = { + __appender(lhs, std::forward(vs))..., 0}; } return std::move(lhs); // prevent return-value optimization