diff options
author | bubnikv <bubnikv@gmail.com> | 2018-01-03 19:57:37 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2018-01-03 19:57:37 +0300 |
commit | 9d98a27b98bf8b27b5d46df14b3f540190364490 (patch) | |
tree | d43c97eb0f62237587dec7222e95cc0cc7375b63 /xs/src/libslic3r | |
parent | b292554fd84e95db9c19fb9f8df56b50cbaec9b5 (diff) |
Fix of compilation on OSX and Linux. By the standard, a temporary
value cannot be passed to a reference.
Diffstat (limited to 'xs/src/libslic3r')
-rw-r--r-- | xs/src/libslic3r/GCodeReader.hpp | 2 | ||||
-rw-r--r-- | xs/src/libslic3r/GCodeTimeEstimator.cpp | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/xs/src/libslic3r/GCodeReader.hpp b/xs/src/libslic3r/GCodeReader.hpp index 4a7825520..9076f375d 100644 --- a/xs/src/libslic3r/GCodeReader.hpp +++ b/xs/src/libslic3r/GCodeReader.hpp @@ -84,7 +84,7 @@ public: return end; } template<typename Callback> - void parse_line(const std::string &line, Callback &callback) + void parse_line(const std::string &line, Callback callback) { GCodeLine gline; this->parse_line(line.c_str(), gline, callback); } void parse_file(const std::string &file, callback_t callback); diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp index 31ee30cc1..8478eb77d 100644 --- a/xs/src/libslic3r/GCodeTimeEstimator.cpp +++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp @@ -156,12 +156,10 @@ namespace Slic3r { void GCodeTimeEstimator::calculate_time_from_lines(const std::vector<std::string>& gcode_lines) { + auto action = [this](GCodeReader &reader, const GCodeReader::GCodeLine &line) + { this->_process_gcode_line(reader, line); }; for (const std::string& line : gcode_lines) - { - _parser.parse_line(line, - [this](GCodeReader &reader, const GCodeReader::GCodeLine &line) - { this->_process_gcode_line(reader, line); }); - } + _parser.parse_line(line, action); _calculate_time(); reset(); } @@ -178,11 +176,11 @@ namespace Slic3r { { PROFILE_FUNC(); GCodeReader::GCodeLine gline; + auto action = [this](GCodeReader &reader, const GCodeReader::GCodeLine &line) + { this->_process_gcode_line(reader, line); }; for (; *ptr != 0;) { gline.reset(); - ptr = _parser.parse_line(ptr, gline, - [this](GCodeReader &reader, const GCodeReader::GCodeLine &line) - { this->_process_gcode_line(reader, line); }); + ptr = _parser.parse_line(ptr, gline, action); } } |