summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRALOVICH, Kristof <tade60@freemail.hu>2013-10-06 20:03:48 +0200
committerRALOVICH, Kristof <tade60@freemail.hu>2013-10-06 20:03:48 +0200
commita2474270f91ab72363a84c2f8c3224b67c2efc63 (patch)
tree3d2b330d81bda53783d8778759bba1ccfacf04fb
parent80aaa8e37bfdb91b8ccddfbc946f5795c2baa7ec (diff)
fix build with clang
Building CXX object CMakeFiles/antpm.dir/SerialTty.cpp.o In file included from /home/tade/dev/antpm/src/SerialTty.cpp:13: In file included from /home/tade/dev/antpm/src/./SerialTty.hpp:15: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/queue:64: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/stl_function.h:741: /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward/binders.h:126:16: error: no matching function for call to object of type 'const antpm::contains' { return op(value, __x); } ^~ /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/stl_algo.h:1176:18: note: in instantiation of member function 'std::binder1st<antpm::contains>::operator()' requested here if(!bool(__pred(*__first))) ^ /home/tade/dev/antpm/src/SerialTty.cpp:262:25: note: in instantiation of function template specialization 'std::remove_if<__gnu_cxx::__normal_iterator<std::basic_string<char> *, std::vector<std::basic_string<char>, std::allocator<std::basic_string<char> > > >, std::binder1st<antpm::contains> >' requested here possibleNames.erase(remove_if(possibleNames.begin(), ^ /home/tade/dev/antpm/src/SerialTty.cpp:236:15: note: candidate function not viable: 'this' argument has type 'const antpm::contains', but method is not marked const inline bool operator() (vector<string> v, string e) {return find(v.begin(), v.end(), e) != v.end();} ^ 1 error generated.
-rwxr-xr-xscripts/conf-for-clang.sh5
-rw-r--r--src/SerialTty.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/scripts/conf-for-clang.sh b/scripts/conf-for-clang.sh
new file mode 100755
index 0000000..1a7d23c
--- /dev/null
+++ b/scripts/conf-for-clang.sh
@@ -0,0 +1,5 @@
+(
+mkdir build-clang
+cd build-clang
+cmake -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_BUILD_TYPE=Release ../src
+)
diff --git a/src/SerialTty.cpp b/src/SerialTty.cpp
index a3d1e7e..59837ad 100644
--- a/src/SerialTty.cpp
+++ b/src/SerialTty.cpp
@@ -233,7 +233,7 @@ SerialTty::~SerialTty()
} while(false)
struct contains : public std::binary_function<vector<string>, string,bool> {
- inline bool operator() (vector<string> v, string e) {return find(v.begin(), v.end(), e) != v.end();}
+ inline bool operator() (vector<string> v, string e) const {return find(v.begin(), v.end(), e) != v.end();}
};
bool