Skip to content

Commit b42c511

Browse files
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.
1 parent 51863d4 commit b42c511

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

dpctl/tensor/libtensor/source/boolean_advanced_indexing.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,44 @@ namespace tensor
4444
namespace py_internal
4545
{
4646

47+
namespace concat_impl
48+
{
49+
4750
struct sink_t
4851
{
4952
sink_t(){};
5053
template <class T> sink_t(T &&){};
5154
};
5255

53-
template <class V> std::size_t accumulate_size(std::size_t &s, V &&v)
56+
template <class V> std::size_t __accumulate_size(std::size_t &s, V &&v)
5457
{
5558
return s += v.size();
5659
}
5760

58-
template <class V, class U> sink_t inserter(V &lhs, U &&rhs)
61+
template <class V, class U> sink_t __appender(V &lhs, U &&rhs)
5962
{
6063
lhs.insert(lhs.end(), rhs.begin(), rhs.end());
6164
return {};
6265
}
6366

67+
} // namespace concat_impl
68+
6469
template <typename T, typename A, typename... Vs>
6570
std::vector<T, A> concat(std::vector<T, A> lhs, Vs &&...vs)
6671
{
72+
using concat_impl::__accumulate_size;
73+
using concat_impl::__appender;
74+
using concat_impl::sink_t;
6775
std::size_t s = lhs.size();
6876
{
6977
// limited scope ensures array is freed
70-
[[maybe_unused]] sink_t tmp[] = {accumulate_size(s, vs)..., 0};
78+
[[maybe_unused]] sink_t tmp[] = {__accumulate_size(s, vs)..., 0};
7179
}
7280
lhs.reserve(s);
7381
{
74-
// array of no-data objects ensures ordering of calls to inserter
75-
[[maybe_unused]] sink_t tmp[] = {inserter(lhs, std::forward<Vs>(vs))...,
76-
0};
82+
// array of no-data objects ensures ordering of calls to the appender
83+
[[maybe_unused]] sink_t tmp[] = {
84+
__appender(lhs, std::forward<Vs>(vs))..., 0};
7785
}
7886

7987
return std::move(lhs); // prevent return-value optimization

0 commit comments

Comments
 (0)