Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a static variable for empty_set, and allow default noexcept move constructor.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 9 May 2023 13:57:50 +0000 (15:57 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 9 May 2023 13:57:50 +0000 (15:57 +0200)
src/xbt/utils/iter/powerset.hpp

index d7b2cdf..b83bad7 100644 (file)
@@ -40,8 +40,6 @@ private:
   std::optional<subsets_iterator<Iterator>> current_subset_iter     = std::nullopt;
   std::optional<subsets_iterator<Iterator>> current_subset_iter_end = std::nullopt;
 
-  const std::vector<Iterator> empty_subset = std::vector<Iterator>();
-
   // boost::iterator_facade<...> interface to implement
   void increment();
   bool equal(const powerset_iterator<Iterator>& other) const;
@@ -70,6 +68,7 @@ template <typename Iterator> const std::vector<Iterator>& powerset_iterator<Iter
   if (current_subset_iter.has_value()) {
     return *current_subset_iter.value();
   }
+  static const std::vector<Iterator> empty_subset;
   return empty_subset;
 }