Skip to content

Commit bfbf021

Browse files
committed
Use std::size_t in xbuilder
1 parent 4fbc6de commit bfbf021

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

include/xtensor/generators/xbuilder.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ namespace xt
499499
{
500500
// trim off extra indices if provided to match behavior of containers
501501
auto dim_offset = std::distance(first, last) - std::get<0>(t).dimension();
502-
size_t axis_dim = *(first + axis + dim_offset);
502+
std::size_t axis_dim = *(first + axis + dim_offset);
503503
auto match = [&](auto& arr)
504504
{
505505
if (axis_dim >= arr.shape()[axis])
@@ -512,16 +512,16 @@ namespace xt
512512

513513
auto get = [&](auto& arr)
514514
{
515-
size_t offset = 0;
516-
const size_t end = arr.dimension();
517-
for (size_t i = 0; i < end; i++)
515+
std::size_t offset = 0;
516+
const std::size_t end = arr.dimension();
517+
for (std::size_t i = 0; i < end; i++)
518518
{
519519
const auto& shape = arr.shape();
520-
const size_t stride = std::accumulate(
520+
const std::size_t stride = std::accumulate(
521521
shape.begin() + i + 1,
522522
shape.end(),
523523
size_t(1),
524-
std::multiplies<size_t>()
524+
std::multiplies<std::size_t>()
525525
);
526526
if (i == axis)
527527
{
@@ -563,21 +563,21 @@ namespace xt
563563
{
564564
auto get_item = [&](auto& arr)
565565
{
566-
size_t offset = 0;
567-
const size_t end = arr.dimension();
568-
size_t after_axis = 0;
569-
for (size_t i = 0; i < end; i++)
566+
std::size_t offset = 0;
567+
const std::size_t end = arr.dimension();
568+
std::size_t after_axis = 0;
569+
for (std::size_t i = 0; i < end; i++)
570570
{
571571
if (i == axis)
572572
{
573573
after_axis = 1;
574574
}
575575
const auto& shape = arr.shape();
576-
const size_t stride = std::accumulate(
576+
const std::size_t stride = std::accumulate(
577577
shape.begin() + static_cast<std::ptrdiff_t>(i) + 1,
578578
shape.end(),
579-
size_t(1),
580-
std::multiplies<size_t>()
579+
std::size_t(1),
580+
std::multiplies<std::size_t>()
581581
);
582582
const auto len = (*(first + static_cast<std::ptrdiff_t>(i + after_axis)));
583583
offset += len * stride;

0 commit comments

Comments
 (0)