Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 3efec23

Browse files
authored
Merge pull request #720 from igchor/merge_stable_1.5_into_stable_1.6
Merge stable 1.5 into stable 1.6
2 parents 8a14df5 + c83ecdc commit 3efec23

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

include/libpmemobj++/experimental/contiguous_iterator.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019, Intel Corporation
2+
* Copyright 2018-2020, Intel Corporation
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -178,7 +178,7 @@ struct contiguous_iterator {
178178
/**
179179
* Element access operator.
180180
*/
181-
Reference operator[](std::size_t n)
181+
Reference operator[](std::ptrdiff_t n)
182182
{
183183
return ptr[n];
184184
}
@@ -262,7 +262,7 @@ struct range_snapshotting_iterator
262262
*
263263
* Adds element to a transaction.
264264
*/
265-
reference operator[](std::size_t n)
265+
reference operator[](std::ptrdiff_t n)
266266
{
267267
detail::conditional_add_to_tx(&this->ptr[n]);
268268
return base_type::operator[](n);
@@ -408,7 +408,7 @@ struct basic_contiguous_iterator
408408
*
409409
* Adds range containing specified element to a transaction.
410410
*/
411-
reference operator[](std::size_t n)
411+
reference operator[](std::ptrdiff_t n)
412412
{
413413
detail::conditional_add_to_tx(&this->ptr[n]);
414414
return base_type::operator[](n);

include/libpmemobj++/experimental/slice.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018, Intel Corporation
2+
* Copyright 2018-2020, Intel Corporation
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -137,7 +137,8 @@ class slice {
137137
if (idx >= size())
138138
throw std::out_of_range("pmem::obj::slice");
139139

140-
return it_begin[idx];
140+
return it_begin[static_cast<typename std::iterator_traits<
141+
Iterator>::difference_type>(idx)];
141142
}
142143

143144
/**
@@ -146,7 +147,8 @@ class slice {
146147
*/
147148
reference operator[](size_type idx)
148149
{
149-
return it_begin[idx];
150+
return it_begin[static_cast<typename std::iterator_traits<
151+
Iterator>::difference_type>(idx)];
150152
}
151153

152154
size_type

tests/array_iterator/array_iterator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019, Intel Corporation
2+
* Copyright 2018-2020, Intel Corporation
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -66,7 +66,7 @@ struct Test1 {
6666

6767
swap(it, it2);
6868

69-
it2[c.size() - 1] = 10;
69+
it2[static_cast<std::ptrdiff_t>(c.size() - 1)] = 10;
7070
it[20] = 20;
7171

7272
UT_ASSERT(c[c.size() - 1] == 10);

0 commit comments

Comments
 (0)