diff --git a/books/RayTracingTheNextWeek.html b/books/RayTracingTheNextWeek.html index db02eb38..fbd0854c 100644 --- a/books/RayTracingTheNextWeek.html +++ b/books/RayTracingTheNextWeek.html @@ -989,7 +989,7 @@ left = objects[start]; right = objects[start+1]; } else { - std::sort(objects.begin() + start, objects.begin() + end, comparator); + std::sort(std::begin(objects) + start, std::begin(objects) + end, comparator); auto mid = start + object_span/2; left = make_shared(objects, start, mid); diff --git a/books/RayTracingTheRestOfYourLife.html b/books/RayTracingTheRestOfYourLife.html index 57dc8f0a..83a0fc89 100644 --- a/books/RayTracingTheRestOfYourLife.html +++ b/books/RayTracingTheRestOfYourLife.html @@ -957,7 +957,7 @@ } // Sort the samples by x. - std::sort(samples, samples + N, compare_by_x); + std::sort(std::begin(samples), std::end(samples), compare_by_x); // Find out the sample at which we have half of our area. double half_sum = sum / 2.0; diff --git a/src/TheNextWeek/bvh.h b/src/TheNextWeek/bvh.h index 7bd2d99b..cdf832a1 100644 --- a/src/TheNextWeek/bvh.h +++ b/src/TheNextWeek/bvh.h @@ -49,7 +49,7 @@ class bvh_node : public hittable { left = objects[start]; right = objects[start+1]; } else { - std::sort(objects.begin() + start, objects.begin() + end, comparator); + std::sort(std::begin(objects) + start, std::begin(objects) + end, comparator); auto mid = start + object_span/2; left = make_shared(objects, start, mid); diff --git a/src/TheRestOfYourLife/bvh.h b/src/TheRestOfYourLife/bvh.h index 7bd2d99b..cdf832a1 100644 --- a/src/TheRestOfYourLife/bvh.h +++ b/src/TheRestOfYourLife/bvh.h @@ -49,7 +49,7 @@ class bvh_node : public hittable { left = objects[start]; right = objects[start+1]; } else { - std::sort(objects.begin() + start, objects.begin() + end, comparator); + std::sort(std::begin(objects) + start, std::begin(objects) + end, comparator); auto mid = start + object_span/2; left = make_shared(objects, start, mid); diff --git a/src/TheRestOfYourLife/estimate_halfway.cc b/src/TheRestOfYourLife/estimate_halfway.cc index 3f3b11a1..316fca1d 100644 --- a/src/TheRestOfYourLife/estimate_halfway.cc +++ b/src/TheRestOfYourLife/estimate_halfway.cc @@ -46,7 +46,7 @@ int main() { } // Sort the samples by x. - std::sort(samples, samples + N, compare_by_x); + std::sort(std::begin(samples), std::end(samples), compare_by_x); // Find out the sample at which we have half of our area. double half_sum = sum / 2.0;