Fix two compilation issues

One was due to enums not having a std::hash below c++17
The other was due to overloaded methods prefering ones in the same namespace (I think)
This commit is contained in:
Benjamin Landers 2018-07-25 00:34:20 -07:00 committed by Joseph Lenox
parent b235640e88
commit 2bbd43c373
3 changed files with 10 additions and 3 deletions

View File

@ -73,7 +73,7 @@ int UI_Slider::get_int() {
}
std::string UI_Slider::get_string() {
return trim_zeroes(std::to_string(static_cast<double>(this->_slider->GetValue()) / this->_scale));
return _trim_zeroes(std::to_string(static_cast<double>(this->_slider->GetValue()) / this->_scale));
}
void UI_Slider::set_scale(size_t new_scale) {

View File

@ -12,7 +12,7 @@ using namespace std;
namespace Slic3r { namespace Test {
// Mesh enumeration to name mapping
const std::unordered_map<TestMesh, const char*> mesh_names {
const std::unordered_map<TestMesh, const char*, TestMeshHash> mesh_names {
std::make_pair<TestMesh, const char*>(TestMesh::A,"A"),
std::make_pair<TestMesh, const char*>(TestMesh::L,"L"),
std::make_pair<TestMesh, const char*>(TestMesh::V,"V"),

View File

@ -33,8 +33,15 @@ enum class TestMesh {
two_hollow_squares
};
// Neccessary for <c++17
struct TestMeshHash {
std::size_t operator()(TestMesh tm) const {
return static_cast<std::size_t>(tm);
}
};
/// Mesh enumeration to name mapping
extern const std::unordered_map<TestMesh, const char*> mesh_names;
extern const std::unordered_map<TestMesh, const char*, TestMeshHash> mesh_names;
/// Port of Slic3r::Test::mesh
/// Basic cubes/boxes should call TriangleMesh::make_cube() directly and rescale/translate it