mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-28 05:12:27 +00:00
ENH: add new way to set bed temperature
jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I99a9f67e9b13b2137ad371b22cf0999ccf9c096d (cherry picked from commit 69c2947daf66eb0a6732b1b980c9b87f597c8da7)
This commit is contained in:
@@ -142,6 +142,29 @@ T get_max_element(const std::vector<T> &vec)
|
||||
}
|
||||
|
||||
|
||||
template <typename From, typename To>
|
||||
std::vector<To> convert_vector(const std::vector<From>& src) {
|
||||
std::vector<To> dst;
|
||||
dst.reserve(src.size());
|
||||
for (const auto& elem : src) {
|
||||
if constexpr (std::is_signed_v<To>) {
|
||||
if (elem > static_cast<From>(std::numeric_limits<To>::max())) {
|
||||
throw std::overflow_error("Source value exceeds destination maximum");
|
||||
}
|
||||
if (elem < static_cast<From>(std::numeric_limits<To>::min())) {
|
||||
throw std::underflow_error("Source value below destination minimum");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (elem < 0) {
|
||||
throw std::invalid_argument("Negative value in source for unsigned destination");
|
||||
}
|
||||
}
|
||||
dst.push_back(static_cast<To>(elem));
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
// Set a path with GUI localization files.
|
||||
void set_local_dir(const std::string &path);
|
||||
// Return a full path to the localization directory.
|
||||
|
||||
Reference in New Issue
Block a user