Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Write LazyPowerSet in terms of iterator_wrapper
[simgrid.git] / src / xbt / utils / iter / LazyPowerset.hpp
1 /* Copyright (c) 2004-2023 The SimGrid Team. All rights reserved.           */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef XBT_UTILS_LAZY_POWER_SET_HPP
7 #define XBT_UTILS_LAZY_POWER_SET_HPP
8
9 #include "src/xbt/utils/iter/iterator_wrapping.hpp"
10 #include "src/xbt/utils/iter/powerset.hpp"
11
12 namespace simgrid::xbt {
13
14 template <class Iterable, class... Args>
15 using LazyPowerset = iterator_wrapping<powerset_iterator<typename Iterable::const_iterator>, Args...>;
16
17 template <class Iterable> constexpr auto make_powerset_iter(const Iterable& container)
18 {
19   return make_iterator_wrapping<powerset_iterator<typename Iterable::const_iterator>>(container.begin(),
20                                                                                       container.end());
21 }
22
23 } // namespace simgrid::xbt
24
25 #endif