[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: [cfe-dev] boost::ref issue
From: Laszlo Nagy <rizsotto.mailinglist () gmail ! com>
Date: 2013-02-19 17:51:16
Message-ID: CAN=tS+FUhdubKERdVbRLx2KBxa8XZAvqcg9fzgfnFCF4vSuB+A () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi All,
I'm trying to compile a C++ project with Clang. It compiles with gcc
without error, but Clang breaks. Unfortunately could not simplify further
and has 'boost' as dependency. I need some help.
How can I change the code to compile with clang? And if it is a not
expected behavior of Clang, what could be an error report for this?
Thanks,
Laszlo
$ clang++ -c test.cpp
test.cpp:9:64: error: no matching function for call to 'ref'
std::for_each(v.begin(), v.end(), boost::bind(&S::bar,
boost::ref(this), _1));
^~~~~~~~~~
/usr/include/boost/ref.hpp:64:63: note: candidate function [with T = S *]
not viable: no known conversion from 'S *' to 'S *&' for 1st argument
template<class T> inline reference_wrapper<T> BOOST_REF_CONST ref(T & t)
^
1 error generated.
[Attachment #5 (text/html)]
<div dir="ltr">Hi All,<div><br></div><div style>I'm trying to compile a C++ \
project with Clang. It compiles with gcc without error, but Clang breaks. \
Unfortunately could not simplify further and has 'boost' as dependency. I \
need some help.</div> <div style><br></div><div style>How can I change the code to \
compile with clang? And if it is a not expected behavior of Clang, what could be an \
error report for this?</div><div style><br></div><div style>Thanks,</div><div style> \
Laszlo</div><div style><br></div><div style><br></div><div style><div>$ clang++ -c \
test.cpp </div><div>test.cpp:9:64: error: no matching function for call to \
'ref'</div><div> std::for_each(v.begin(), v.end(), \
boost::bind(&S::bar, boost::ref(this), _1));</div> <div> \
^~~~~~~~~~</div><div>/usr/include/boost/ref.hpp:64:63: note: candidate function [with \
T = S *] not viable: no known conversion from 'S *' to 'S *&' for \
1st argument</div> <div>template<class T> inline reference_wrapper<T> \
BOOST_REF_CONST ref(T & t)</div><div> \
^</div><div>1 error generated.</div></div></div>
--f46d04339f02f9f45d04d6177cdd--
["test.cpp" (text/x-c++src)]
#include <vector>
#include <algorithm>
#include <boost/bind.hpp>
struct S
{
void foo() {
std::vector<int> v;
std::for_each(v.begin(), v.end(), boost::bind(&S::bar, boost::ref(this), _1));
}
void bar(int j) { m_j += j; }
int m_j;
};
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic