Skip to content

Commit 3f5e359

Browse files
committed
fixes for MSVC and nvc++
- MSVC finds the get(...) member function, so we need to call the free function explicitly - the structured bindings refer to a reference
1 parent 2a7275c commit 3f5e359

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

core/base/iterator_factory.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <tuple>
1414
#include <utility>
1515

16+
#include <ginkgo/core/base/types.hpp>
17+
1618
#include "core/base/copy_assignable.hpp"
1719

1820

@@ -290,15 +292,15 @@ class zip_iterator_reference
290292
// std::tuple<int, char> t = { 1, '2' }; is not allowed.
291293
// converting to 'std::tuple<...>' from initializer list would use
292294
// explicit constructor
293-
return value_type(get<idxs>(*this)...);
295+
return value_type(gko::get<idxs>(*this)...);
294296
}
295297

296298
template <std::size_t... idxs>
297299
constexpr void assign_impl(std::index_sequence<idxs...>,
298300
const value_type& other)
299301
{
300302
(void)std::initializer_list<int>{
301-
(get<idxs>(*this) = get<idxs>(other), 0)...};
303+
(gko::get<idxs>(*this) = gko::get<idxs>(other), 0)...};
302304
}
303305

304306
constexpr explicit zip_iterator_reference(Iterators... it)
@@ -509,7 +511,7 @@ class zip_iterator {
509511
auto other_it = get<0>(other.iterators_);
510512
auto result = fn(it, other_it);
511513
forall_impl(
512-
other, [&](auto a, auto b) { assert(it - other_it == a - b); },
514+
other, [&](auto a, auto b) { GKO_ASSERT(it - other_it == a - b); },
513515
index_sequence{});
514516
return result;
515517
}

test/base/iterator_factory.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ void run_zip_iterator(std::shared_ptr<gko::EXEC_TYPE> exec,
5252
}
5353
// check structured bindings
5454
auto [key, value] = *begin;
55-
static_assert(std::is_same<typeof(key), int>::value,
55+
static_assert(std::is_same<std::remove_reference_t<decltype(key)>,
56+
int>::value,
5657
"incorrect type");
5758
gko::get<0>(*begin) = value;
5859
},

0 commit comments

Comments
 (0)