This repository was archived by the owner on Mar 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
include/libpmemobj++/experimental Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 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);
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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 );
You can’t perform that action at this time.
0 commit comments