mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-03 09:28:44 +03:00
Merge prusa 2.6.1
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <libslic3r/libslic3r.h>
|
||||
|
||||
#include "Optimizer.hpp"
|
||||
|
||||
namespace Slic3r { namespace opt {
|
||||
@@ -104,29 +106,6 @@ struct NLoptRAII { // Helper RAII class for nlopt_opt
|
||||
~NLoptRAII() { nlopt_destroy(ptr); }
|
||||
};
|
||||
|
||||
// Map a generic function to each argument following the mapping function
|
||||
template<class Fn, class...Args>
|
||||
Fn for_each_argument(Fn &&fn, Args&&...args)
|
||||
{
|
||||
// see https://www.fluentcpp.com/2019/03/05/for_each_arg-applying-a-function-to-each-argument-of-a-function-in-cpp/
|
||||
(fn(std::forward<Args>(args)),...);
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
// Call fn on each element of the input tuple tup.
|
||||
template<class Fn, class Tup>
|
||||
Fn for_each_in_tuple(Fn fn, Tup &&tup)
|
||||
{
|
||||
auto mpfn = [&fn](auto&...pack) {
|
||||
for_each_argument(fn, pack...);
|
||||
};
|
||||
|
||||
std::apply(mpfn, tup);
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
// Wrap each element of the tuple tup into a wrapper class W and return
|
||||
// a new tuple with each element being of type W<T_i> where T_i is the type of
|
||||
// i-th element of tup.
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
#include <cassert>
|
||||
#include <optional>
|
||||
|
||||
#ifdef WIN32
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
namespace Slic3r { namespace opt {
|
||||
|
||||
template<class T, class O = T>
|
||||
|
||||
Reference in New Issue
Block a user