From e13f401af62ff5a4ad57c76bb2b81a7c23f6964b Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Fri, 18 Nov 2016 00:33:41 +0100 Subject: [PATCH] Fix build error with Ubuntu precise's version of GCC with C++11 enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forcing `make_pair<>` via explicit arguments leads the compiler to try to match it against the version with universal references (T&&), failing because the compiler does not want to match "v.size()-1" to it. Error example: /<>.../exprtk.hpp:5455:74: error: no matching function for call to ‘make_pair(bool, std::basic_string::size_type&)’ /<>.../exprtk.hpp:5455:74: note: candidate is: /usr/include/c++/4.6/bits/stl_pair.h:262:5: note: template std::pair::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) /<>.../exprtk.hpp: In constructor ‘exprtk::details::stringvar_node::stringvar_node(std::string&)’: /<>.../exprtk.hpp:7364:74: error: no matching function for call to ‘make_pair(bool, std::basic_string::size_type&)’ /<>/libs/base/include/mrpt/otherlibs/exprtk.hpp:7364:74: note: candidate is: /usr/include/c++/4.6/bits/stl_pair.h:262:5: note: template std::pair::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) /usr/bin/cmake -E cmake_progress_report "/<>/obj-arm-linux-gnueabihf/CMakeFiles" --- exprtk.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exprtk.hpp b/exprtk.hpp index 4ebf2a6..3c741e8 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -5452,7 +5452,7 @@ namespace exprtk : value_(v) { rp_.n0_c = std::make_pair(true,0); - rp_.n1_c = std::make_pair(true,v.size() - 1); + rp_.n1_c = std::make_pair(true, size_t(v.size() - 1)); rp_.cache.first = rp_.n0_c.second; rp_.cache.second = rp_.n1_c.second; } @@ -7361,7 +7361,7 @@ namespace exprtk : value_(&v) { rp_.n0_c = std::make_pair(true,0); - rp_.n1_c = std::make_pair(true,v.size() - 1); + rp_.n1_c = std::make_pair(true, size_t(v.size() - 1)); rp_.cache.first = rp_.n0_c.second; rp_.cache.second = rp_.n1_c.second; }