Skip to content

pivot.hpp std::size_t fix #61

@urnathan

Description

@urnathan

In applying clang implicit module machinery to boost headers I came across this problem (and by implication C++20 header-units will have the same problem). It prevents boost/sort/common/pivot.hpp being an importable header.

pivot.hpp refers to 'size_t', not std::size_t, thereby implicitly relying on its importers' contexts. Fixed thusly, it becomes a self-contained header and so a C++ 20 importable header.

--- c/1.77.0/src/boost_1_77_0/boost/sort/common/pivot.hpp
+++ w/1.77.0/src/boost_1_77_0/boost/sort/common/pivot.hpp
@@ -14,6 +14,7 @@
 #define __BOOST_SORT_COMMON_PIVOT_HPP
 
 #include <cstdint>
+#include <utility>
 
 namespace boost
 {
@@ -109,7 +110,7 @@ inline Iter_t mid9 (Iter_t iter_1, Iter_t iter_2, Iter_t iter_3, Iter_t iter_4,
 template < class Iter_t, class Compare >
 inline void pivot9 (Iter_t first, Iter_t last, Compare comp)
 {
-    size_t cupo = (last - first) >> 3;
+    std::size_t cupo = (last - first) >> 3;
     Iter_t itaux = mid9 (first + 1, first + cupo, first + 2 * cupo,
                          first + 3 * cupo, first + 4 * cupo, first + 5 * cupo,
                          first + 6 * cupo, first + 7 * cupo, last - 1, comp);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions