@@ -1098,36 +1098,37 @@ checkFogVolume(const GridType& grid, size_t n)
10981098
10991099namespace diagnostics_internal {
11001100
1101+ constexpr static auto cmp = [](auto a, auto b) { return math::cwiseLessThan (a, b); };
1102+ template <typename T>
1103+ using SetType = std::set<T, decltype (cmp)>;
11011104
11021105template <typename TreeType>
11031106class InactiveVoxelValues
11041107{
11051108public:
11061109 using LeafArray = tree::LeafManager<TreeType>;
11071110 using ValueType = typename TreeType::ValueType;
1108- using SetType = std::set<ValueType>;
11091111
11101112 InactiveVoxelValues (LeafArray&, size_t numValues);
11111113
11121114 void runParallel ();
11131115 void runSerial ();
11141116
1115- void getInactiveValues (SetType&) const ;
1117+ void getInactiveValues (SetType<ValueType> &) const ;
11161118
11171119 inline InactiveVoxelValues (const InactiveVoxelValues<TreeType>&, tbb::split);
11181120 inline void operator ()(const tbb::blocked_range<size_t >&);
11191121 inline void join (const InactiveVoxelValues<TreeType>&);
11201122
11211123private:
11221124 LeafArray& mLeafArray ;
1123- SetType mInactiveValues ;
1125+ SetType<ValueType> mInactiveValues {cmp} ;
11241126 size_t mNumValues ;
11251127};// InactiveVoxelValues
11261128
11271129template <typename TreeType>
11281130InactiveVoxelValues<TreeType>::InactiveVoxelValues(LeafArray& leafs, size_t numValues)
11291131 : mLeafArray (leafs)
1130- , mInactiveValues ()
11311132 , mNumValues (numValues)
11321133{
11331134}
@@ -1137,7 +1138,6 @@ inline
11371138InactiveVoxelValues<TreeType>::InactiveVoxelValues(
11381139 const InactiveVoxelValues<TreeType>& rhs, tbb::split)
11391140 : mLeafArray (rhs.mLeafArray )
1140- , mInactiveValues ()
11411141 , mNumValues (rhs.mNumValues )
11421142{
11431143}
@@ -1184,7 +1184,7 @@ InactiveVoxelValues<TreeType>::join(const InactiveVoxelValues<TreeType>& rhs)
11841184
11851185template <typename TreeType>
11861186inline void
1187- InactiveVoxelValues<TreeType>::getInactiveValues(SetType& values) const
1187+ InactiveVoxelValues<TreeType>::getInactiveValues(SetType< typename TreeType::ValueType> & values) const
11881188{
11891189 values.insert (mInactiveValues .begin (), mInactiveValues .end ());
11901190}
@@ -1199,38 +1199,35 @@ class InactiveTileValues
11991199public:
12001200 using IterRange = tree::IteratorRange<typename TreeType::ValueOffCIter>;
12011201 using ValueType = typename TreeType::ValueType;
1202- using SetType = std::set<ValueType>;
12031202
12041203 InactiveTileValues (size_t numValues);
12051204
12061205 void runParallel (IterRange&);
12071206 void runSerial (IterRange&);
12081207
1209- void getInactiveValues (SetType&) const ;
1208+ void getInactiveValues (SetType<ValueType> &) const ;
12101209
12111210 inline InactiveTileValues (const InactiveTileValues<TreeType>&, tbb::split);
12121211 inline void operator ()(const IterRange&);
12131212 inline void join (const InactiveTileValues<TreeType>&);
12141213
12151214private:
1216- SetType mInactiveValues ;
1215+ SetType<ValueType> mInactiveValues {cmp} ;
12171216 size_t mNumValues ;
12181217};
12191218
12201219
12211220template <typename TreeType>
12221221InactiveTileValues<TreeType>::InactiveTileValues(size_t numValues)
1223- : mInactiveValues ()
1224- , mNumValues (numValues)
1222+ : mNumValues (numValues)
12251223{
12261224}
12271225
12281226template <typename TreeType>
12291227inline
12301228InactiveTileValues<TreeType>::InactiveTileValues(
12311229 const InactiveTileValues<TreeType>& rhs, tbb::split)
1232- : mInactiveValues ()
1233- , mNumValues (rhs.mNumValues )
1230+ : mNumValues (rhs.mNumValues )
12341231{
12351232}
12361233
@@ -1275,7 +1272,7 @@ InactiveTileValues<TreeType>::join(const InactiveTileValues<TreeType>& rhs)
12751272
12761273template <typename TreeType>
12771274inline void
1278- InactiveTileValues<TreeType>::getInactiveValues(SetType& values) const
1275+ InactiveTileValues<TreeType>::getInactiveValues(SetType< typename TreeType::ValueType> & values) const
12791276{
12801277 values.insert (mInactiveValues .begin (), mInactiveValues .end ());
12811278}
@@ -1294,9 +1291,8 @@ uniqueInactiveValues(const GridType& grid,
12941291{
12951292 using TreeType = typename GridType::TreeType;
12961293 using ValueType = typename GridType::ValueType;
1297- using SetType = std::set<ValueType>;
12981294
1299- SetType uniqueValues;
1295+ diagnostics_internal:: SetType<ValueType> uniqueValues {diagnostics_internal::cmp} ;
13001296
13011297 { // Check inactive voxels
13021298 TreeType& tree = const_cast <TreeType&>(grid.tree ());
@@ -1320,10 +1316,8 @@ uniqueInactiveValues(const GridType& grid,
13201316
13211317 values.clear ();
13221318 values.reserve (uniqueValues.size ());
1323-
1324- typename SetType::iterator it = uniqueValues.begin ();
1325- for ( ; it != uniqueValues.end (); ++it) {
1326- values.push_back (*it);
1319+ for (const auto & item : uniqueValues) {
1320+ values.emplace_back (item);
13271321 }
13281322
13291323 return values.size () <= numValues;
0 commit comments